home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-07-14 | 97.8 KB | 4,067 lines |
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/lib/Changelo,v
- retrieving revision 1.94
- diff -c -r1.94 Changelo
- *** 1.94 1993/05/29 20:26:25
- --- Changelo 1993/07/13 17:07:21
- ***************
- *** 3765,3767 ****
- --- 3765,3982 ----
- out soft float stuff knows nothing about long doubles.
-
- ---------------------------- Patchlevel 90 ---------------------------
- +
- + _addsubs.cpp, _addsubd.cpp, _div*.cpp, _mul*.cpp:: michal
- + following some discussions with Olaf I rewrote addition routines to
- + conform - at least here - strictly to IEEE spec. As a matter of fact
- + they even decreased in size. :-)
- +
- + this stuff which I am mailing you right now corrects handling
- + various cased when you add or multiply infinities or NaNs.
- + To my best knowledge this now follows IEEE specifications, although
- + do not quote me on that. :-) There is also some code rearangement
- + in division routines to reduce unnecessary branching.
- +
- + thanks michal!
- +
- + osbind.h:: Markus Gutschke <srb242@GOEDEL.UNI-MUENSTER.DE>
- + stack adjustment amount was wrong. was 6 should be 10. thanks
- + markus.
- +
- + osbind.h:: Robert.Wilhelm@Physik.TU-Muenchen.DE
- + wrong stack adjustment for trap_1_wwwll was 16 should have
- + been 14. thanks robert.
- +
- + ---------------------------- Patchlevel 91 ---------------------------
- +
- + pgrp::
- + NEWFILE from mintlib 31
- +
- + unistd.h:
- + Added pause() and sigpause() prototypes. Changed prototype of
- + setpgrp() to reflect new SysV-compatible version, and make proto
- + apply only if not _POSIX_SOURCE. Changed prototype of getpgrp() to
- + reflect return type of pid_t (POSIX). Added setpgid(), setsid(),
- + _bsd_setpgrp() and _bsd_getpgrp() protos. To access the BSD
- + functions by their usual names, define the macro _BSD_PGRP (and do
- + _not_ define _POSIX_SOURCE) before including unistd.h (for example,
- + gcc -D_BSD_PGRP -c foo.c).
- +
- + pgrp.c:
- + NEW file, for process group related functions. Renamed setpgrp to
- + _bsd_setpgrp(). Created new SysV-compatible setpgrp(). Created
- + new BSD-compatible _bsd_getpgrp() (requires MiNT 1.03 or newer).
- + Created new POSIX setpgid() and setsid().
- +
- +
- + putpwent.c::
- + NEW file from mntlib 31
- +
- + eprintf.c:: mntlib31
- + throw away status buffer. [move buffer onto stk]
- +
- + findfile.c:: mntlib31
- + rehacked by Uwe Ohse, 28.4.93, to support reentrant spawn/popen.
- +
- + getpw.c:: mntlib31
- + sync up with what appears to be a rewrite
- +
- + grp.c:: mntlib31
- + ditto
- +
- + linea.h, grp.h, ioctl.h, mintbind.h, osbind.h, ostruct.h pwd.h ::
- + sync with mntlib 31.
- +
- + ---------------------------- Patchlevel 92 ---------------------------
- +
- + main.c:: andreas
- + the isatty status should be cleared for dumped programs
- +
- + float.h:: andreas
- + update for GCC 2.4/enquire 4.3; the values for
- + LDBL_{EPSILON,MIN,MAX} are computed with bc and verified with enquire.
- +
- + support.h: ++warwick@cs.uq.oz.au
- + Remove two occurances of the string "new" for C++ compatibility.
- +
- + ctype.h: ++entropy
- + More POSIX namespace monkey business.
- +
- + types.h: ++entropy
- + Made lots of stuff #ifndef _POSIX_SOURCE. Added a few POSIX types
- + (nlink_t, mode_t).
- +
- + doprnt.c: ++hohmuth
- + Make a long constant explicit for Pure C.
- +
- + setjmp.h: ++entropy
- + Implemented BSD-compatible _setjmp(), _longjmp(), setjmp(), and
- + longjmp(). Selectable by defining _BSD_SOURCE. BUG: not compatible
- + with __STRICT_ANSI__.
- +
- + fcntl.h: ++entropy
- + Add POSIX-required mask FD_CLOEXEC, to select the close-on-exec
- + bit from the flags used in F_GETFD/F_SETFD fcntl().
- +
- + unistd.h: ++entropy
- + Do not define prototype for getopt() if _POSIX_SOURCE is defined.
- +
- + types.h: ++entropy
- + Do not #include <utime.h> if _POSIX_SOURCE is defined.
- +
- + utime.h: ++entropy
- + Added prototype for utime().
- +
- + unistd.h: ++entropy
- + Changed BSD process group selection switch from _BSD_PGRP to
- + _BSD_SOURCE.
- +
- + stat.h: ++nox, ++entropy
- + Added S_ISCHR(), S_ISDIR(), S_ISBLK(), S_ISREG(), S_ISFIFO(),
- + S_ISMEM(), S_ISLNK(), S_IRWXU, S_IRWXG, S_IRWXO.
- + (btw, is S_IMEM a typo of S_IFMEM or was that intentional?)
- +
- + setjmp.cpp, setjmp.h: ++entropy
- + Implemented POSIX sigsetjmp() and setlongjmp().
- +
- + fopen.c: ++entropy
- + Always use O_NOCTTY flag in the call to open().
- +
- + errno.h, strerror.c: ++entropy
- + Add definition of EIO and ENOSPC.
- +
- + support.h: ++entropy
- + Prototype for _isctty() from the MiNT libs.
- +
- + ctermid.c, stdio.h: ++entropy
- + NEW file, POSIX ctermid() function. Prototype and constant L_ctermid
- + in stdio.h.
- +
- + doprnt.c: ++dsb@cs.duke.edu
- + HSC choked on a string with implicit newlines (that is,
- + "like
- + this"
- + as GCC is wont to do); I replaced it with explicit "\n"'s and string
- + concatenation.
- +
- + fread.c, fwrite.c: ++dsb
- + Some judicious changes from size_t to unsigned long to allow reads
- + and writes of >=64K with HSC.
- +
- + getpw.c: ++dsb
- + Minor tweak to work around a foible in HSC.
- +
- + compiler.h: ++dsb
- + Changes for HSC v2.00 and higher.
- +
- + utime.h: ++dsb
- + Changed "#endif _UTIME_H" to "#endif /* _UTIME_H */" to keep HSC
- + from complaining.
- +
- + fcntl.h: ++entropy
- + O_NOCTTY definition (for the MiNT libs).
- +
- + pgrp.c: ++entropy
- + Made a more reasonable attempt at setsid(). Kludge a way to
- + "disassociate" the controlling tty by forcing fd -1 to /dev/null.
- +
- + fwrite.c:: michal
- + With unbuffered IO fwrite miscounts number of characters written.
- +
- + a64l.c, calloc.c, chdir.c, chmod.c, eprintf.c, grp.c,lib.h, linea.c,
- + psignal.c, putenv.c, raise.c, random.c, regexp.c, regsup.c, strlwr.c,
- + strrev.c, strupr.c, strvar.c, textio.c, timeoday.c, *.h:: entropy
- + sync up with mntlib pl 33. most changes are cleanups.
- + (what does linea2 return?)
- +
- + --- sync with mntlib34:
- + ffs.c: ++frog
- + Much faster algorithm.
- +
- + Makefile, _fixsfsi.cpp, _fltsisf.cpp,
- + frexp.cpp, modf.cpp : ++dc4i@br0.hrz.th-darmstadt.de (Stefan Steyer)
- + Bug fixes for SFP004 coprocessor code. Add sfp004 targets.
- +
- + doprnt.c: ++schwab@ls5.informatik.uni-dortmund.de (Andreas Schwab)
- + The decimal precision in a printf format does not include the sign or
- + hex prefix, e.g. printf ("%-2.5d", -18) should print "-00018".
- +
- + time.h: ++Frank_Baumgart@pb.maus.de
- + Add prototype of select() to time.h (is there a better place?)
- +
- + ctype.h, grp.h, dirent.h, stddef.h, string.h: ++entropy
- + Cleaned up for POSIX.
- +
- + wait.h, pwd.h: ++entropy
- + Cleaned up for POSIX (need more work).
- +
- + compiler.h, limits.h, stdio.h: ++entropy
- + Set stream limits for POSIX.
- +
- + locale.h: ++entropy
- + Define NULL if not already defined (POSIX).
- +
- + limits.h: ++entropy
- + Raise value of _POSIX_NGROUPS_MAX from 0 to arbitrary value of
- + 512 now that we have a decent getgroups().
- +
- + fcntl.h, errno.h: ++entropy
- + Add definition of F_SETLKW to fcntl.h. Add ELOCKED to errno.h.
- + If Fcntl() gets ELOCKED, return EACCES instead (POSIX).
- +
- + unistd.h, stat.h, fcntl.h: ++entropy
- + Moved many prototypes to the correct headers.
- +
- + signal.h: ++entropy
- + Fix some violations of POSIX namespace.
- +
- + -- end sync
- +
- + findfile.c:: michal
- + try to accomodate tos style paths
- + PATH=e:\bin,c:\bin,...
- +
- + unistd.h:: ++jrb
- + take out setlinebuf proto, it does'nt really belong here.
- +
- + ---------------------------- Patchlevel 93 ---------------------------
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/lib/Makefile,v
- retrieving revision 1.18
- diff -c -r1.18 Makefile
- *** 1.18 1993/05/21 12:52:49
- --- Makefile 1993/07/13 17:07:24
- ***************
- *** 96,117 ****
- ASFLAGS= -c
-
- # flags to $(CC) when running preprocessor and assembler
- ! PPFLAGS= $(SHORT) -P -c
-
- # library targets
- ifdef MINTFLAG
-
- ! CLIB= $bmint$g$(ST).olb
- ! CLIB020=$bmint$g$(ST)020.olb
- ! IIOLIB= $bmiio$g$(ST).olb
- CRT0=$bmcrt0.o
- GCRT0=$bmgcrt0.o
-
- else
-
- ! CLIB= $bgnu$g$(ST).olb
- ! CLIB020=$bgnu$g$(ST)020.olb
- ! IIOLIB= $biio$g$(ST).olb
- CRT0=$bcrt0.o
- GCRT0=$bgcrt0.o
-
- --- 96,117 ----
- ASFLAGS= -c
-
- # flags to $(CC) when running preprocessor and assembler
- ! PPFLAGS= $(XPFLAGS) $(SHORT) $(SFPFLAG) -P -c
-
- # library targets
- ifdef MINTFLAG
-
- ! CLIB= $bmint$g$(SFP)$(ST).olb
- ! CLIB020=$bmint$g$(SFP)$(ST)020.olb
- ! IIOLIB= $bmiio$g$(SFP)$(ST).olb
- CRT0=$bmcrt0.o
- GCRT0=$bmgcrt0.o
-
- else
-
- ! CLIB= $bgnu$g$(SFP)$(ST).olb
- ! CLIB020=$bgnu$g$(SFP)$(ST)020.olb
- ! IIOLIB= $biio$g$(SFP)$(ST).olb
- CRT0=$bcrt0.o
- GCRT0=$bgcrt0.o
-
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/lib/PatchLev.h,v
- retrieving revision 1.66
- diff -c -r1.66 PatchLev.h
- *** 1.66 1993/05/29 20:26:29
- --- PatchLev.h 1993/07/13 17:07:26
- ***************
- *** 1,5 ****
-
- ! #define PatchLevel "90"
-
- /*
- *
- --- 1,5 ----
-
- ! #define PatchLevel "93"
-
- /*
- *
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/lib/main.c,v
- retrieving revision 1.25
- diff -c -r1.25 main.c
- *** 1.25 1993/03/16 22:09:03
- --- main.c 1993/07/10 16:41:34
- ***************
- *** 75,81 ****
- --- 75,85 ----
- extern int __default_mode__; /* in defmode.c or defined by user */
- int main(int, char **, char **);
-
- + /* clear isatty status for dumped programs */
- + for (i = 0; i < __NHANDLES; i++)
- + __open_stat[i].status = FH_UNKNOWN;
- _start_time = 0; /* for dumped prgs */
- +
- _start_time = clock();
- _child_runtime = _sys_runtime = 0;
- num_at_exit = 0;
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/lib/mincl,v
- retrieving revision 1.28
- diff -c -r1.28 mincl
- *** 1.28 1993/05/29 20:26:34
- --- mincl 1993/07/10 16:41:35
- ***************
- *** 38,46 ****
- #
- # other portable stuff
- PORT = a64l.o alphasor.o abs.o catch.o dirent.o findfile.o ftw.o getpw.o \
- ! getlogin.o getopt.o getpass.o ident.o mktemp.o scandir.o strlwr.o \
- strrev.o strupr.o regexp.o regsup.o textio.o random.o obstack.o \
- ! il.o ic.o iw.o ig.o ip.o frwbin.o
- #
- # the string library
-
- --- 38,46 ----
- #
- # other portable stuff
- PORT = a64l.o alphasor.o abs.o catch.o dirent.o findfile.o ftw.o getpw.o \
- ! getlogin.o getopt.o getpass.o ident.o mktemp.o putpwent.o scandir.o strlwr.o \
- strrev.o strupr.o regexp.o regsup.o textio.o random.o obstack.o \
- ! il.o ic.o iw.o ig.o ip.o frwbin.o ctermid.o cuserid.o ffs.o
- #
- # the string library
-
- ***************
- *** 54,60 ****
-
- UNIX= access.o chdir.o chmod.o close.o console.o device.o dup.o exec.o fcntl.o \
- fhandle.o fork.o getcwd.o getpid.o getuid.o grp.o ioctl.o isatty.o \
- ! link.o lseek.o mkdir.o null.o open.o perror.o pipe.o popen.o psignal.o \
- read.o rename.o rmdir.o \
- sbrk.o sgtty.o signal.o siglist.o sleep.o spawnve.o spawnvp.o stat.o \
- symdir.o symlink.o tchars.o time.o timeoday.o times.o \
- --- 54,60 ----
-
- UNIX= access.o chdir.o chmod.o close.o console.o device.o dup.o exec.o fcntl.o \
- fhandle.o fork.o getcwd.o getpid.o getuid.o grp.o ioctl.o isatty.o \
- ! link.o lseek.o mkdir.o null.o open.o perror.o pgrp.o pipe.o popen.o psignal.o \
- read.o rename.o rmdir.o \
- sbrk.o sgtty.o signal.o siglist.o sleep.o spawnve.o spawnvp.o stat.o \
- symdir.o symlink.o tchars.o time.o timeoday.o times.o \
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/lib/signal.c,v
- retrieving revision 1.7
- diff -c -r1.7 signal.c
- *** 1.7 1992/03/28 06:40:31
- --- signal.c 1993/07/10 16:41:37
- ***************
- *** 21,33 ****
- --- 21,39 ----
- __Sigfunc s_func;
- };
- /* SIG_DFL == 0, so everything is implicitly set to this */
- + /* vector giving which signals are currently blocked from delivery (for TOS) */
- + long _sigmask;
-
- + /* vector giving an indication of which signals are currently pending (for TOS) */
- + long _sigpending;
- +
- static struct sigarray_str sig_array[NSIG] ;
-
- void
- _init_signal() /* needed for dumping */
- {
- bzero(sig_array, sizeof(sig_array)); /* for now */
- + _sigpending = _sigmask = 0;
- }
-
- __Sigfunc signal(sig, func)
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_addsubd.cpp,v
- retrieving revision 1.7
- diff -c -r1.7 _addsubd.cpp
- *** 1.7 1993/05/29 20:28:20
- --- _addsubd.cpp 1993/06/04 15:22:06
- ***************
- *** 11,16 ****
- --- 11,20 ----
- | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- |
- + | Revision 1.3.6 michal 05-93 (ntomczak@vm.ucs.ualberta.ca)
- + | + ensure that x - x always returns +0, says IEEE,
- + | unless x is Inf or NaN - then return NaN
- + |
- | Revision 1.3.5 michal 05-93 (ntomczak@vm.ucs.ualberta.ca)
- | + code smoothing
- |
- ***************
- *** 69,85 ****
- movel d0,d2 | d2.h = u.sign
- swap d0
- movew d0,d2 | d2.l = u.sign
- - bclr #15,d0 | kill sign bit
- - lsrw #4,d0
-
- movel d4,d1 | d1 = v.exp
- andl d3,d4 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2.l = u.sign ^ v.sign (in bit 15)
- ! bclr #15,d1 | kill sign bit
- lsrw #4,d1
- |
- ! | Now perform testing of NaN And infinities
- |
- movew #0x7ff,d3
- cmpw d3,d0
- --- 73,98 ----
- movel d0,d2 | d2.h = u.sign
- swap d0
- movew d0,d2 | d2.l = u.sign
-
- movel d4,d1 | d1 = v.exp
- andl d3,d4 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2.l = u.sign ^ v.sign (in bit 15)
- ! clrb d2 | we will use the lowest byte as a flag
- ! moveq #15,d3
- ! bclr d3,d0 | kill sign bit u.exp
- ! bclr d3,d1 | kill sign bit v.exp
- ! btst d3,d2 | same sign for u and v?
- ! beq 0f
- ! cmpl d0,d1 | different signs - maybe x - x ?
- ! bne 0f
- ! cmpl d5,d7
- ! seq d2 | set 'cancellation' flag
- !
- ! 0: lsrw #4,d0 | keep here exponents only
- lsrw #4,d1
- |
- ! | Now perform testing of NaN and infinities
- |
- movew #0x7ff,d3
- cmpw d3,d0
- ***************
- *** 87,158 ****
- cmpw d3,d1
- bne nospec
- bra 1f
- - | first operand is special
- - |
- - 0: cmpw d0,d1
- - beq bothspec
- |
- | u is special
- |
- movel d7,d0
- orl d6,d0
- ! bne retnan | arith with Nan gives always Nan
- !
- ! movel a0@(8),d0 | copy infinity
- ! moveq #0,d1
- ! bra return
- |
- | v is special
- |
- 1: movel d5,d0
- orl d4,d0
- bne retnan
- ! movel a0@,d0
- moveq #0,d1
- ! bra return
- ! |
- ! | u and v are both special
- ! |
- ! bothspec:
- ! movel d7,d0
- ! orl d6,d0
- ! orl d5,d0
- ! orl d4,d0
- ! bne retnan
- ! |
- ! | Both are infinities Test if cancellation
- ! |
- ! bothinf:
- ! tstw d2
- ! bpl retinf
- |
- | return a quiet NaN
- |
- retnan: moveql #-1,d1
- movel d1,d0
- ! bclr #31,d0 | 0x7fffffff -> d0
- bra return
- -
- - retinf: moveq #0,d1
- - movel #0xffe00000,d0 | we will return #0xfff00000 or #0x7ff00000
- - lslw #1,d2
- - roxrl #1,d0 | shift in high bit as given by d2
- - return: moveml sp@+,d2-d7
- - rts
- |
- ! | Ok, no inifinty or Nan involved..
- |
- ! nospec: bset #20,d6 | restore implied leading "1"
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #20,d6 | no implied leading "1", instead ...
- ! addw #1,d0 | "normalize" exponent
- 1:
- ! bset #20,d4 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #20,d4 | no implied leading "1", instead ...
- ! addw #1,d1 | "normalize" exponent
- 1:
- moveq #0,d3 | init sticky register
- negw d1 | d1 = u.exp - v.exp
- --- 100,154 ----
- cmpw d3,d1
- bne nospec
- bra 1f
- |
- | u is special
- |
- + 0: tstb d2
- + bne retnan | cancellation of specials -> NaN
- movel d7,d0
- orl d6,d0
- ! bne retnan | arith with Nan gives always NaN
- ! addqw #8,a0 | adding to an address propagates anyway
- ! cmpw d3,d1
- ! bne 0f | skip check for NaN if v not special
- |
- | v is special
- |
- 1: movel d5,d0
- orl d4,d0
- bne retnan
- ! 0: movel a0@,d0 | copy infinity
- moveq #0,d1
- ! bra return
- |
- | return a quiet NaN
- |
- retnan: moveql #-1,d1
- movel d1,d0
- ! lsrl #1,d0 | 0x7fffffff -> d0
- bra return
- |
- ! | Ok, no inifinty or NaN involved..
- |
- ! nospec: tstb d2
- ! beq 0f
- ! moveq #0,d0 | x - x hence we always return +0
- ! movel d0,d1
- ! return: moveml sp@+,d2-d7
- ! rts
- !
- ! 0: moveq #20,d3
- ! bset d3,d6 | restore implied leading "1"
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d6 | no implied leading "1", instead ...
- ! addqw #1,d0 | "normalize" exponent
- 1:
- ! bset d3,d4 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d4 | no implied leading "1", instead ...
- ! addqw #1,d1 | "normalize" exponent
- 1:
- moveq #0,d3 | init sticky register
- negw d1 | d1 = u.exp - v.exp
- ***************
- *** 174,184 ****
- | most significant digit, while gaining an additional digit for
- | rounding.
- |
- ! moveql #1,d3
- 2: addl d7,d7
- addxl d6,d6
- ! subw #1,d0 | decrement exponent
- ! subw #1,d1 | decrement counter
- dbeq d3,2b
- moveq #0,d3
- |
- --- 170,180 ----
- | most significant digit, while gaining an additional digit for
- | rounding.
- |
- ! moveq #1,d3
- 2: addl d7,d7
- addxl d6,d6
- ! subqw #1,d0 | decrement exponent
- ! subqw #1,d1 | decrement counter
- dbeq d3,2b
- moveq #0,d3
- |
- ***************
- *** 192,198 ****
- swap d5
- clrw d4
- swap d4
- ! subw #16,d1
- bra 3b
-
- 0: moveb d5,d2 | use d2.b as scratch
- --- 188,195 ----
- swap d5
- clrw d4
- swap d4
- ! subqw #8,d1
- ! subqw #8,d1
- bra 3b
-
- 0: moveb d5,d2 | use d2.b as scratch
- ***************
- *** 206,216 ****
- tstw d2 | are the signs equal ?
- bpl 6f | yes, no negate necessary
- |
- ! | negate secand mantissa. One has to check the sticky word in order
- | to correct the twos complement.
- |
- tstw d3 |
- ! beq 9f | No cerrection necessary
- moveq #0,d1
- addql #1,d5
- addxl d1,d4
- --- 203,213 ----
- tstw d2 | are the signs equal ?
- bpl 6f | yes, no negate necessary
- |
- ! | negate second mantissa. One has to check the sticky word in order
- | to correct the twos complement.
- |
- tstw d3 |
- ! beq 9f | No correction necessary
- moveq #0,d1
- addql #1,d5
- addxl d1,d4
- ***************
- *** 226,232 ****
-
- negl d7
- negxl d6
- ! notl d2 | switch sign
- 7:
- movel d6,d4 | move result for normalization
- movel d7,d5
- --- 223,229 ----
-
- negl d7
- negxl d6
- ! notl d2 | switch sign
- 7:
- movel d6,d4 | move result for normalization
- movel d7,d5
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_addsubs.cpp,v
- retrieving revision 1.7
- diff -c -r1.7 _addsubs.cpp
- *** 1.7 1993/05/29 20:28:21
- --- _addsubs.cpp 1993/06/04 15:22:08
- ***************
- *** 12,17 ****
- --- 12,19 ----
- | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- |
- | Revision 1.3.5 michal 05-93 (ntomczak@vm.ucs.ualberta.ca)
- + | + ensure that x - x always returns +0, says IEEE,
- + | unless x is Inf or NaN - then return NaN
- | + code smoothing
- |
- | patched by Olaf Flebbe (flebbe@tat.physik.uni-tuebingen.de)
- ***************
- *** 71,87 ****
- swap d0
- movew d0,d2 | d2 = u.sign
- andl d3,d5 | remove exponent from u.mantissa
- - bclr #15,d0 | kill sign bit
- - lsrw #7,d0
-
- movel d4,d1 | d1 = v.exp
- andl d3,d4 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2 = u.sign ^ v.sign (in bit 15)
- ! bclr #15,d1 | kill sign bit
- lsrw #7,d1
- |
- ! | Now perform testing of NaN And infinities
- |
- moveq #-1,d3
- cmpb d3,d0
- --- 73,96 ----
- swap d0
- movew d0,d2 | d2 = u.sign
- andl d3,d5 | remove exponent from u.mantissa
-
- movel d4,d1 | d1 = v.exp
- andl d3,d4 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2 = u.sign ^ v.sign (in bit 15)
- ! clrb d2 | we will use the lowest byte as a flag
- ! moveq #15,d3
- ! bclr d3,d1 | kill sign bit u.exp
- ! bclr d3,d0 | kill sign bit u.exp
- ! btst d3,d2 | same sign for u and v?
- ! bne 0f
- ! cmpl d0,d1 | different signs - maybe x - x ?
- ! seq d2 | set 'cancellation' flag
- ! 0:
- ! lsrw #7,d0 | keep here exponents only
- lsrw #7,d1
- |
- ! | Now perform testing of NaN and infinities
- |
- moveq #-1,d3
- cmpb d3,d0
- ***************
- *** 89,151 ****
- cmpb d3,d1
- bne nospec
- bra 1f
- - | first operand is special
- |
- - 0: cmpb d0,d1
- - beq bothspec
- - |
- | u is special
- |
- tstl d5
- ! bne retnan | arith with Nan gives always Nan
-
- ! movel a0@(4),d0 | copy infinity with its sign
- ! bra return
- |
- | v is special
- |
- 1: tstl d4
- bne retnan
- ! movel a0@,d0
- bra return
- |
- - | u and v are both special
- - |
- - bothspec:
- - movel d5,d0
- - orl d4,d0
- - bne retnan
- - |
- - | Both are infinities Test if cancellation
- - |
- - bothinf:
- - tstw d2
- - bpl retinf
- - |
- | return a quiet NaN
- |
- retnan: moveql #-1,d0
- lsrl #1,d0 | 0x7fffffff -> d0
- bra return
- -
- - retinf: movel #0xff000000,d0 | we will return #0xff800000 or #0x7f800000
- - lslw #1,d2
- - roxrl #1,d0 | shift in high bit as given by d2
- - return: moveml sp@+,d2-d5
- - rts
- |
- ! | Ok, no inifinty or Nan involved..
- |
- ! nospec: bset #23,d5 | restore implied leading "1"
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #23,d5 | remove it
- addqw #1,d0 | "normalize" exponent
- 1:
- ! bset #23,d4 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #23,d4 | remove it
- addqw #1,d1 | "normalize" exponent
- 1:
- moveq #0,d3 | (put initial zero rounding bits in d3)
- --- 98,147 ----
- cmpb d3,d1
- bne nospec
- bra 1f
- |
- | u is special
- |
- + 0: tstb d2
- + bne retnan | cancellation of specials -> NaN
- tstl d5
- ! bne retnan | arith with Nan gives always NaN
-
- ! addqw #4,a0 | here is an infinity
- ! cmpb d3,d1
- ! bne 0f | skip check for NaN if v not special
- |
- | v is special
- |
- 1: tstl d4
- bne retnan
- ! 0: movel a0@,d0
- bra return
- |
- | return a quiet NaN
- |
- retnan: moveql #-1,d0
- lsrl #1,d0 | 0x7fffffff -> d0
- bra return
- |
- ! | Ok, no inifinty or NaN involved..
- |
- ! nospec: tstb d2
- ! beq 0f
- ! moveq #0,d0 | x - x hence we always return +0
- ! return: moveml sp@+,d2-d5
- ! rts
- !
- ! 0: moveq #23,d3
- ! bset d3,d5 | restore implied leading "1"
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d5 | remove it
- addqw #1,d0 | "normalize" exponent
- 1:
- ! bset d3,d4 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d4 | remove it
- addqw #1,d1 | "normalize" exponent
- 1:
- moveq #0,d3 | (put initial zero rounding bits in d3)
- ***************
- *** 179,185 ****
- orw d4,d3 | set rounding bits
- clrw d4
- swap d4
- ! subw #16,d1
- bra 4f
-
- 0: moveb d4,d2
- --- 175,182 ----
- orw d4,d3 | set rounding bits
- clrw d4
- swap d4
- ! subqw #8,d1
- ! subqw #8,d1
- bra 4f
-
- 0: moveb d4,d2
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_divdf3.cpp,v
- retrieving revision 1.7
- diff -c -r1.7 _divdf3.cpp
- *** 1.7 1993/05/29 20:28:23
- --- _divdf3.cpp 1993/06/04 15:22:10
- ***************
- *** 82,95 ****
- andl d3,d4 | remove exponent from u.mantissa
- swap d0
- movew d0,d2 | d2 = u.sign
- - bclr #15,d0 | kill sign bit
- - lsrw #4,d0
-
- movel d6,d1 | d1 = v.exp
- andl d3,d6 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2 = u.sign ^ v.sign (in bit 15)
- ! bclr #15,d1 | kill sign bit
- lsrw #4,d1
- |
- |
- --- 82,97 ----
- andl d3,d4 | remove exponent from u.mantissa
- swap d0
- movew d0,d2 | d2 = u.sign
-
- movel d6,d1 | d1 = v.exp
- andl d3,d6 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2 = u.sign ^ v.sign (in bit 15)
- !
- ! moveq #15,d3
- ! bclr d3,d1 | kill sign bit
- ! bclr d3,d0 | kill sign bit
- ! lsrw #4,d0
- lsrw #4,d1
- |
- |
- ***************
- *** 111,170 ****
- movel d7,d3
- orl d6,d3
- bne nospec
- ! bra retinf | x/0 -> +/- Inf
-
- 0: orl d5,d4 | u == NaN ?
- bne retnan | NaN/ x
- ! cmpw #0x7ff,d1
- beq retnan | Inf/Inf or Inf/NaN
- bra retinf | Inf/x | x != Inf && x != NaN
-
- 1: orl d7,d6
- bne retnan | x/NaN
- ! bra retzero | x/Inf -> +/- 0
-
- 2: tstw d1
- bne retzero | 0/x ->+/- 0
- orl d5,d4
- bne retzero | 0/x
- ! bra retnan | 0/0
- ! |
- ! | Return Infinity with correct sign
- ! |
- ! retinf: moveq #0,d1
- ! movel #0xffe00000,d0
- ! lslw #1,d2
- ! roxrl #1,d0 | shift in high bit as given by d2
- ! return: moveml sp@+,d2-d7
- ! rts
- |
- | Return NaN
- |
- retnan: moveql #-1,d1
- movel d1,d0
- ! bclr #31,d0 | 0x7fffffff -> d0
- ! bra return
- ! |
- ! | Return correct signed zero
- ! |
- ! retzero:moveq #0,d0 | zero destination
- ! movel d0,d1
- ! lslw #1,d2 | we need an extension bit
- ! roxrl #1,d0
- bra return
- |
- | End of special handling
- |
- ! nospec: bset #20,d4 | restore implied leading "1"
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #20,d4 | remove it
- addw #1,d0 | "normalize" exponent
-
- ! 1: bset #20,d6 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #20,d6 | remove it
- 0: addw #1,d1 | "normalize" exponent
-
- 1: movew d2,a0 | save sign
- --- 113,173 ----
- movel d7,d3
- orl d6,d3
- bne nospec
- ! | bra retinf | x/0 -> +/- Inf
- ! |
- ! | Return Infinity with correct sign
- ! |
- ! retinf: moveq #0,d1
- ! movel #0xffe00000,d0
- ! lslw #1,d2
- ! roxrl #1,d0 | shift in high bit as given by d2
- ! return: moveml sp@+,d2-d7
- ! rts
-
- 0: orl d5,d4 | u == NaN ?
- bne retnan | NaN/ x
- ! cmpw d3,d1
- beq retnan | Inf/Inf or Inf/NaN
- bra retinf | Inf/x | x != Inf && x != NaN
-
- 1: orl d7,d6
- bne retnan | x/NaN
- ! | bra retzero | x/Inf -> +/- 0
- ! |
- ! | Return correct signed zero
- ! |
- ! retzero:moveq #0,d0 | zero destination
- ! movel d0,d1
- ! lslw #1,d2 | we need an extension bit
- ! roxrl #1,d0
- ! bra return
-
- 2: tstw d1
- bne retzero | 0/x ->+/- 0
- orl d5,d4
- bne retzero | 0/x
- ! | bra retnan | 0/0
- |
- | Return NaN
- |
- retnan: moveql #-1,d1
- movel d1,d0
- ! lsrl #1,d0 | 0x7fffffff -> d0
- bra return
- |
- | End of special handling
- |
- ! nospec: moveq #20,d3
- ! bset d3,d4 | restore implied leading "1"
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d4 | remove it
- addw #1,d0 | "normalize" exponent
-
- ! 1: bset d3,d6 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d6 | remove it
- 0: addw #1,d1 | "normalize" exponent
-
- 1: movew d2,a0 | save sign
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_divsf3.cpp,v
- retrieving revision 1.7
- diff -c -r1.7 _divsf3.cpp
- *** 1.7 1993/05/29 20:28:26
- --- _divsf3.cpp 1993/06/04 15:22:12
- ***************
- *** 82,102 ****
- andl d3,d4 | remove exponent from u.mantissa
- swap d0
- movew d0,d2 | d2 = u.sign
- - bclr #15,d0 | kill sign bit
- - lsrw #7,d0
-
- movel d5,d1 | d1 = v.exp
- andl d3,d5 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2 = u.sign ^ v.sign (in bit 15)
- ! bclr #15,d1 | kill sign bit
- lsrw #7,d1
- |
- |
- |
- moveq #-1,d3
- cmpb d3,d0 | comparison with #0xff
- ! beq 0f |u == NaN || u== Inf
- cmpb d3,d1
- beq 1f | v == NaN || v == Inf
- tstb d0
- --- 82,104 ----
- andl d3,d4 | remove exponent from u.mantissa
- swap d0
- movew d0,d2 | d2 = u.sign
-
- movel d5,d1 | d1 = v.exp
- andl d3,d5 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2 = u.sign ^ v.sign (in bit 15)
- !
- ! moveq #15,d3
- ! bclr d3,d0 | kill sign bit
- ! bclr d3,d1 | kill sign bit
- ! lsrw #7,d0
- lsrw #7,d1
- |
- |
- |
- moveq #-1,d3
- cmpb d3,d0 | comparison with #0xff
- ! beq 0f | u == NaN || u== Inf
- cmpb d3,d1
- beq 1f | v == NaN || v == Inf
- tstb d0
- ***************
- *** 115,131 ****
- bne retnan | NaN/ x
- cmpb d3,d1
- beq retnan | Inf/Inf or Inf/NaN
- ! bra retinf | Inf/x | x != Inf && x != NaN
- !
- ! 1: tstl d5
- ! bne retnan | x/NaN
- ! bra retzero | x/Inf -> +/- 0
- !
- ! 2: tstw d1
- ! bne retzero | 0/x ->+/- 0
- ! tstl d4
- ! bne retzero | 0/x
- ! bra retnan | 0/0
- |
- | Return Infinity with correct sign
- |
- --- 117,123 ----
- bne retnan | NaN/ x
- cmpb d3,d1
- beq retnan | Inf/Inf or Inf/NaN
- ! | bra retinf | Inf/x | x != Inf && x != NaN
- |
- | Return Infinity with correct sign
- |
- ***************
- *** 134,145 ****
- roxrl #1,d0 | shift in high bit as given by d2
- return: moveml sp@+,d2-d5
- rts
- ! |
- ! | Return NaN
- ! |
- ! retnan: movel d3,d0 | d3 contains 0xffffffff
- ! bclr #31,d0
- ! bra return
- |
- | Return correct signed zero
- |
- --- 126,135 ----
- roxrl #1,d0 | shift in high bit as given by d2
- return: moveml sp@+,d2-d5
- rts
- !
- ! 1: tstl d5
- ! bne retnan | x/NaN
- ! | bra retzero | x/Inf -> +/- 0
- |
- | Return correct signed zero
- |
- ***************
- *** 147,168 ****
- lslw #1,d2 | set X bit accordingly
- roxrl #1,d0
- bra return
- |
- | End of special handling
- |
- ! nospec: bset #23,d4 | restore implied leading "1"
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #23,d4 | remove it
- addw #1,d0 | "normalize" exponent
- 1:
- tstl d4
- beq retzero | dividing zero
-
- ! bset #23,d5 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #23,d5 | remove it
- addw #1,d1 | "normalize" exponent
- 1:
- # ifndef ERROR_CHECK
- --- 137,171 ----
- lslw #1,d2 | set X bit accordingly
- roxrl #1,d0
- bra return
- +
- + 2: tstw d1
- + bne retzero | 0/x ->+/- 0
- + tstl d4
- + bne retzero | 0/x
- + | bra retnan | 0/0
- + |
- + | Return NaN
- + |
- + retnan: movel d3,d0 | d3 contains 0xffffffff
- + lsrl #1,d0
- + bra return
- |
- | End of special handling
- |
- ! nospec: moveq #23,d3
- ! bset d3,d4 | restore implied leading "1"
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d4 | remove it
- addw #1,d0 | "normalize" exponent
- 1:
- tstl d4
- beq retzero | dividing zero
-
- ! bset d3,d5 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d5 | remove it
- addw #1,d1 | "normalize" exponent
- 1:
- # ifndef ERROR_CHECK
- ***************
- *** 171,181 ****
- # endif ERROR_CHECK
-
- subw d1,d0 | subtract exponents,
- ! addw #BIAS4-8+1,d0 | add bias back in, account for shift
- ! addw #34,d0 | add loop offset, +2 for extra rounding bits
- ! | for denormalized numbers (2 implied by dbra)
- movew #27,d1 | bit number for "implied" pos (+4 for rounding)
- ! moveql #-1,d3 | zero quotient (for speed a one''s complement)
- subl d5,d4 | initial subtraction, u = u - v
- 2:
- btst d1,d3 | divide until 1 in implied position
- --- 174,184 ----
- # endif ERROR_CHECK
-
- subw d1,d0 | subtract exponents,
- ! addw #BIAS4-8+1,d0 | add bias back in, account for shift
- ! addw #34,d0 | add loop offset, +2 for extra rounding bits
- ! | for denormalized numbers (2 implied by dbra)
- movew #27,d1 | bit number for "implied" pos (+4 for rounding)
- ! moveql #-1,d3 | zero quotient (for speed a one''s complement)
- subl d5,d4 | initial subtraction, u = u - v
- 2:
- btst d1,d3 | divide until 1 in implied position
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_fixsfsi.cpp,v
- retrieving revision 1.4
- diff -c -r1.4 _fixsfsi.cpp
- *** 1.4 1993/05/29 20:28:30
- --- _fixsfsi.cpp 1993/07/13 17:03:36
- ***************
- *** 28,33 ****
- --- 28,34 ----
- 1: cmpiw #0x8900,a0@(resp)
- beq 1b
- movel a0@,d0
- + rts
-
- #else /* !sfp004 */
-
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_fltsisf.cpp,v
- retrieving revision 1.3
- diff -c -r1.3 _fltsisf.cpp
- *** 1.3 1993/05/29 20:28:32
- --- _fltsisf.cpp 1993/07/13 17:03:38
- ***************
- *** 23,29 ****
- movew #0x4000,a0@(comm) | load long int to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ! movew #0x7400,a0@(comm) | get double from fp0
- | wait loop is NOT coded directly
- 1: cmpw #0x8900,a0@(resp)
- beq 1b
- --- 23,29 ----
- movew #0x4000,a0@(comm) | load long int to fp0
- cmpiw #0x8900,a0@(resp) | check
- movel a7@(4),a0@
- ! movew #0x6400,a0@(comm) | get single from fp0
- | wait loop is NOT coded directly
- 1: cmpw #0x8900,a0@(resp)
- beq 1b
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_muldf3.cpp,v
- retrieving revision 1.5
- diff -c -r1.5 _muldf3.cpp
- *** 1.5 1993/05/29 20:28:35
- --- _muldf3.cpp 1993/06/04 15:22:14
- ***************
- *** 58,63 ****
- --- 58,66 ----
- |
- | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- + | Revision 1.2.4 michal 05-93 (ntomczak@vm.ucs.ualberta.ca)
- + | + ensure that Inf * NaN == NaN * Inf == NaN
- + | and 0 * Inf = Inf * 0 = NaN
- |
- | Revision 1.2.3 michal 05-93 (ntomczak@vm.ucs.ualberta.ca)
- | + code smoothing
- ***************
- *** 91,104 ****
- andl d3,d6 | remove exponent from u.mantissa
- swap d0
- movew d0,d2 | d2 = u.sign
- - bclr #15,d0 | kill sign bit
- - lsrw #4,d0
-
- movel d4,d1 | d1 = v.exp
- andl d3,d4 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2 = u.sign ^ v.sign (in bit 15)
- ! bclr #15,d1 | kill sign bit
- lsrw #4,d1
- |
- | Testing for NaN and Infinities
- --- 94,117 ----
- andl d3,d6 | remove exponent from u.mantissa
- swap d0
- movew d0,d2 | d2 = u.sign
-
- movel d4,d1 | d1 = v.exp
- andl d3,d4 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2 = u.sign ^ v.sign (in bit 15)
- !
- ! moveq #15,d3
- ! bclr d3,d0 | kill sign bit
- ! bclr d3,d1 | kill sign bit
- ! tstl d0 | test if one of factors is 0
- ! bne 0f | if not the first one then maybe the second
- ! tstl d7
- ! beq 1f
- ! 0: tstl d1
- ! bne 1f
- ! tstl d5
- ! 1: seq d2 | 'one of factors is 0' flag in the lowest byte
- ! lsrw #4,d0 | keep in d0, d1 exponents only
- lsrw #4,d1
- |
- | Testing for NaN and Infinities
- ***************
- *** 113,123 ****
- | Nan?
- 0: orl d7,d6
- bne retnan
- ! | Test v==0.
- ! tstw d1
- ! bne retinf | Inf * x == Inf
- ! orl d5,d4
- ! beq retnan | Inf * 0 == NaN
- |
- | Return Infinity with correct sign
- |
- --- 126,135 ----
- | Nan?
- 0: orl d7,d6
- bne retnan
- ! 1: tstb d2 | 0 times special or special times 0 ?
- ! bne retnan | yes -> NaN
- ! cmpw d3,d1 | is the other special?
- ! beq 2f | maybe it is NaN
- |
- | Return Infinity with correct sign
- |
- ***************
- *** 128,168 ****
- return: moveml sp@+,d2-d7
- rts
- |
- | Return NaN
- |
- retnan: moveql #-1,d1
- movel d1,d0
- ! bclr #31,d0 | 0x7fffffff -> d0
- bra return
- |
- - | v is special
- - |
- - 1: orl d5,d4
- - bne retnan
- - tstw d0
- - bne retinf
- - orl d7,d6
- - beq retnan
- - bra retinf
- - |
- | end of NaN and Inf.
- |
- ! nospec: subw #16,sp | multiplication accumulator
-
- ! bset #20,d6 | restore implied leading "1"
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #20,d6 | remove it
- ! addw #1,d0 | "normalize" exponent
- 1: movel d6,d3
- orl d7,d3
- beq retz | multiplying by zero
-
- ! bset #20,d4 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #20,d4 | remove it
- ! addw #1,d1 | "normalize" exponent
- 1: movel d4,d3
- orl d5,d3
- beq retz | multiplying by zero
- --- 140,179 ----
- return: moveml sp@+,d2-d7
- rts
- |
- + | v is special
- + |
- + 2: orl d5,d4 | is v NaN?
- + beq retinf | if not then we have (not-NaN * Inf)
- + |
- | Return NaN
- |
- retnan: moveql #-1,d1
- movel d1,d0
- ! lsrl #1,d0 | 0x7fffffff -> d0
- bra return
- |
- | end of NaN and Inf.
- |
- ! nospec: tstb d2 | not needed - but we can waste two instr.
- ! bne retzz | return signed 0 if one of factors is 0
- ! lea sp@(-16),sp | multiplication accumulator
-
- ! moveq #20,d3
- ! bset d3,d6 | restore implied leading "1"
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d6 | remove it
- ! addqw #1,d0 | "normalize" exponent
- 1: movel d6,d3
- orl d7,d3
- beq retz | multiplying by zero
-
- ! moveq #20,d3
- ! bset d3,d4 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d4 | remove it
- ! addqw #1,d1 | "normalize" exponent
- 1: movel d4,d3
- orl d5,d3
- beq retz | multiplying by zero
- ***************
- *** 227,233 ****
- movew d6,d5
- movew d7,d6
- clrw d7
- ! subw #16,d0 | decrement exponent
- bra 2b
- 3:
- movel d6,d1 | get rounding bits
- --- 238,245 ----
- movew d6,d5
- movew d7,d6
- clrw d7
- ! subqw #8,d0 | decrement exponent
- ! subqw #8,d0
- bra 2b
- 3:
- movel d6,d1 | get rounding bits
- ***************
- *** 237,250 ****
- andl #0xffffff00,d3
- beq 4f
- orb #1,d1 | set "sticky bit" if any low-order set
- ! 4: addw #16,sp | remove accumulator from stack
- jmp norm_df | (result in d4/d5)
- | | norm_df does not return here
- ! retz: moveq #0,d0 | save zero as result
- movel d0,d1
- lslw #1,d2 | fill X bit
- roxrl #1,d0 | set high bit of d0 accordingly
- - addw #16,sp
- moveml sp@+,d2-d7
- rts | no normalizing neccessary
-
- --- 249,262 ----
- andl #0xffffff00,d3
- beq 4f
- orb #1,d1 | set "sticky bit" if any low-order set
- ! 4: lea sp@(16),sp | remove accumulator from stack
- jmp norm_df | (result in d4/d5)
- | | norm_df does not return here
- ! retz: lea sp@(16),sp | drop accumulator space
- ! retzz: moveq #0,d0 | save zero as result
- movel d0,d1
- lslw #1,d2 | fill X bit
- roxrl #1,d0 | set high bit of d0 accordingly
- moveml sp@+,d2-d7
- rts | no normalizing neccessary
-
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/_mulsf3.cpp,v
- retrieving revision 1.5
- diff -c -r1.5 _mulsf3.cpp
- *** 1.5 1993/05/29 20:28:36
- --- _mulsf3.cpp 1993/06/04 15:22:16
- ***************
- *** 46,51 ****
- --- 46,55 ----
- | written by Kai-Uwe Bloem (I5110401@dbstu1.bitnet).
- | Based on a 80x86 floating point packet from comp.os.minix, written by P.Housel
- |
- + | Revision 1.2.4 michal 05-93 (ntomczak@vm.ucs.ualberta.ca)
- + | + ensure that Inf * NaN == NaN * Inf == NaN
- + | and 0 * Inf = Inf * 0 = NaN
- + |
- | Revision 1.2.3 michal 05-93 (ntomczak@vm.ucs.ualberta.ca)
- | + code smoothing
- |
- ***************
- *** 79,92 ****
- andl d3,d5 | remove exponent from u.mantissa
- swap d0
- movew d0,d2 | d2 = u.sign
- - bclr #15,d0 | kill sign bit
- - lsrw #7,d0
-
- movel d4,d1 | d1 = v.exp
- andl d3,d4 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2 = u.sign ^ v.sign (in bit 15)
- ! bclr #15,d1 | kill sign bit
- lsrw #7,d1
-
- |
- --- 83,102 ----
- andl d3,d5 | remove exponent from u.mantissa
- swap d0
- movew d0,d2 | d2 = u.sign
-
- movel d4,d1 | d1 = v.exp
- andl d3,d4 | remove exponent from v.mantissa
- swap d1
- eorw d1,d2 | d2 = u.sign ^ v.sign (in bit 15)
- !
- ! moveq #15,d3
- ! bclr d3,d0 | kill sign bit
- ! bclr d3,d1 | kill sign bit
- ! tstl d0 | test if one of factors is 0
- ! beq 1f
- ! tstl d1
- ! 1: seq d2 | 'one of factors is 0' flag in the lowest byte
- ! lsrw #7,d0 | keep here exponents only
- lsrw #7,d1
-
- |
- ***************
- *** 98,113 ****
- cmpb d3,d1
- bne nospec
- bra 1f
- | first operand is special
- ! | Nan?
- ! 0: tstl d5
- bne retnan
- ! | Test v==0.
- ! tstb d1
- ! bne retinf | Inf * x == Inf
- ! tstl d4
- ! beq retnan | Inf * 0 == NaN
- !
- |
- | Return Infinity with correct sign
- |
- --- 108,122 ----
- cmpb d3,d1
- bne nospec
- bra 1f
- + |
- | first operand is special
- ! |
- ! 0: tstl d5 | is it NaN?
- bne retnan
- ! 1: tstb d2 | 0 times special or special times 0 ?
- ! bne retnan | yes -> NaN
- ! cmpb d3,d1 | is the other special ?
- ! beq 2f | maybe it is NaN
- |
- | Return Infinity with correct sign
- |
- ***************
- *** 116,153 ****
- roxrl #1,d0 | shift in high bit as given by d2
- return: moveml sp@+,d2-d5
- rts
- |
- ! | Return NaN
- |
- retnan: moveql #-1,d0
- lsrl #1,d0 | 0x7fffffff -> d0
- bra return
- |
- - | v is special
- - |
- - 1: tstl d4
- - bne retnan
- - tstb d0
- - bne retinf
- - tstl d5
- - beq retnan
- - bra retinf
- - |
- | end of NaN and Inf.
- |
- ! nospec: bset #23,d5 | restore implied leading "1"
- ! subw #8,sp | multiplication accumulator
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #23,d5 | remove it
- addqw #1,d0 | "normalize" exponent
- 1: tstl d5
- beq retz | multiplying zero
-
- ! bset #23,d4 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr #23,d4 | remove it
- addqw #1,d1 | "normalize" exponent
- 1: tstl d4
- beq retz | multiply by zero
- --- 125,160 ----
- roxrl #1,d0 | shift in high bit as given by d2
- return: moveml sp@+,d2-d5
- rts
- +
- |
- ! | v is special
- |
- +
- + 2: tstl d4 | is this NaN?
- + beq retinf | we know that the other is not zero
- retnan: moveql #-1,d0
- lsrl #1,d0 | 0x7fffffff -> d0
- bra return
- |
- | end of NaN and Inf.
- |
- ! nospec: tstb d2 | not needed - but we can waste two instr.
- ! bne retzz | return signed 0 if one of factors is 0
- ! moveq #23,d3
- ! bset d3,d5 | restore implied leading "1"
- ! subqw #8,sp | multiplication accumulator
- tstw d0 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d5 | remove it
- addqw #1,d0 | "normalize" exponent
- 1: tstl d5
- beq retz | multiplying zero
-
- ! moveq #23,d3
- ! bset d3,d4 | restore implied leading "1"
- tstw d1 | check for zero exponent - no leading "1"
- bne 1f
- ! bclr d3,d4 | remove it
- addqw #1,d1 | "normalize" exponent
- 1: tstl d4
- beq retz | multiply by zero
- ***************
- *** 193,199 ****
- swap d5 | with a denormalized number; there''s an
- movew d5,d4 | eventual loss of 4 bits in the rounding
- clrw d5 | byte -- what a pity 8-)
- ! subw #16,d0 | decrement exponent
- bra 2b
- 3:
- movel d5,d1 | get rounding bits
- --- 200,207 ----
- swap d5 | with a denormalized number; there''s an
- movew d5,d4 | eventual loss of 4 bits in the rounding
- clrw d5 | byte -- what a pity 8-)
- ! subqw #8,d0 | decrement exponent
- ! subqw #8,d0
- bra 2b
- 3:
- movel d5,d1 | get rounding bits
- ***************
- *** 202,214 ****
- andl #0xffffff00,d3
- beq 4f
- orb #1,d1 | set "sticky bit" if any low-order set
- ! 4: addw #8,sp | remove accumulator from stack
- jmp norm_sf | (result in d4)
-
- ! retz: moveq #0,d0 | save zero as result
- lslw #1,d2 | and set it sign as for d2
- roxrl #1,d0
- - addw #8,sp
- moveml sp@+,d2-d5
- rts | no normalizing neccessary
-
- --- 210,222 ----
- andl #0xffffff00,d3
- beq 4f
- orb #1,d1 | set "sticky bit" if any low-order set
- ! 4: addqw #8,sp | remove accumulator from stack
- jmp norm_sf | (result in d4)
-
- ! retz: addqw #8,sp | release accumulator space
- ! retzz: moveq #0,d0 | save zero as result
- lslw #1,d2 | and set it sign as for d2
- roxrl #1,d0
- moveml sp@+,d2-d5
- rts | no normalizing neccessary
-
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/a64l.c,v
- retrieving revision 1.1
- diff -c -r1.1 a64l.c
- *** 1.1 1993/05/21 12:58:12
- --- a64l.c 1993/07/10 16:36:33
- ***************
- *** 56,61 ****
- --- 56,62 ----
- Hildo Biersma, with the help of a UN*X System V man page.
- */
-
- + #include <support.h>
- #include <errno.h>
- extern int errno;
-
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/calloc.c,v
- retrieving revision 1.2
- diff -c -r1.2 calloc.c
- *** 1.2 1992/09/14 14:56:40
- --- calloc.c 1993/07/10 16:36:34
- ***************
- *** 21,27 ****
- {
- void *r;
- unsigned long total;
- - extern void _bzero();
-
- total = n * sz;
- if ((r = _malloc(total)) != NULL) {
- --- 21,26 ----
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/chdir.c,v
- retrieving revision 1.11
- diff -c -r1.11 chdir.c
- *** 1.11 1992/06/24 15:32:04
- --- chdir.c 1993/07/10 16:36:36
- ***************
- *** 30,37 ****
- d+=2;
- (void)Dsetdrv(drv);
- }
- - else
- - drv = old;
-
- if (!*d) { /* empty path means root directory */
- *d = '\\';
- --- 30,35 ----
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/chmod.c,v
- retrieving revision 1.8
- diff -c -r1.8 chmod.c
- *** 1.8 1992/09/14 14:56:40
- --- chmod.c 1993/07/10 16:36:37
- ***************
- *** 70,76 ****
- if (__mint >= 9) {
- (void)_unx2dos(_name, name);
- r = (int)Fchown(name, uid, gid);
- ! if (r) {
- errno = -r;
- return -1;
- }
- --- 70,76 ----
- if (__mint >= 9) {
- (void)_unx2dos(_name, name);
- r = (int)Fchown(name, uid, gid);
- ! if (r && (r != -EINVAL)) {
- errno = -r;
- return -1;
- }
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/doprnt.c,v
- retrieving revision 1.23
- diff -c -r1.23 doprnt.c
- *** 1.23 1993/05/21 12:55:09
- --- doprnt.c 1993/07/10 16:51:54
- ***************
- *** 368,374 ****
- if ((((unsigned long)_dd.i[0] > INF_HI) &&
- /* mj: check for a negative zero; it is not smaller than zero, so it
- was not negated */
- ! (_dd.i[0] != 0x80000000 || _dd.i[1] != 0)) ||
- ((unsigned long)_dd.i[0] == INF_HI &&
- (unsigned long)_dd.i[1] > INF_LO))
- {
- --- 368,374 ----
- if ((((unsigned long)_dd.i[0] > INF_HI) &&
- /* mj: check for a negative zero; it is not smaller than zero, so it
- was not negated */
- ! (_dd.i[0] != 0x80000000L || _dd.i[1] != 0)) ||
- ((unsigned long)_dd.i[0] == INF_HI &&
- (unsigned long)_dd.i[1] > INF_LO))
- {
- ***************
- *** 524,534 ****
- * fieldsz excludes decimal prec; realsz includes it
- */
- fieldsz = size + fpprec;
- if (sign)
- ! fieldsz++;
- if (flags & HEXPREFIX)
- ! fieldsz += 2;
- ! realsz = dprec > fieldsz ? dprec : fieldsz;
-
- /* right-adjusting blank padding */
- if ((flags & (LADJUST|ZEROPAD)) == 0 && width)
- --- 524,534 ----
- * fieldsz excludes decimal prec; realsz includes it
- */
- fieldsz = size + fpprec;
- + realsz = dprec > fieldsz ? dprec : fieldsz;
- if (sign)
- ! realsz++;
- if (flags & HEXPREFIX)
- ! realsz += 2;
-
- /* right-adjusting blank padding */
- if ((flags & (LADJUST|ZEROPAD)) == 0 && width)
- ***************
- *** 609,638 ****
-
- /* static */ void Format __PROTO ((double number, char *buf));
-
- ! asm ("
- ! comm = -6;
- ! resp = -16;
- ! .text
- ! .even
- ! _Format:
- ! lea 0xfffffa50:w,a0 | fpu address
- ! lea sp@(4),a1 | argptr
- !
- ! movew #0x5400,a0@(comm) | fmoved -> fp0
- ! 1: cmpw #0x8900,a0@(resp)
- ! beq 1b
- ! movel a1@+,a0@
- ! movel a1@+,a0@
- !
- ! movel a1@,a1 | get buf
- ! movew #0x6c11,a0@(comm) | fmovep fp0,a1@{#17}
- ! 1: cmpw #0x8900,a0@(resp)
- ! beq 1b
- ! movel a0@,a1@+
- ! movel a0@,a1@+
- ! movel a0@,a1@+
- ! rts
- ! ");
- #endif /* sfp004 */
-
- static int
- --- 609,638 ----
-
- /* static */ void Format __PROTO ((double number, char *buf));
-
- ! asm (
- ! "comm = -6;\n"
- ! "resp = -16;\n"
- ! ".text\n"
- ! ".even\n"
- ! "_Format:\n"
- ! " lea 0xfffffa50:w,a0 | fpu address\n"
- ! " lea sp@(4),a1 | argptr\n"
- !
- ! " movew #0x5400,a0@(comm) | fmoved -> fp0\n"
- ! "1: cmpw #0x8900,a0@(resp)\n"
- ! " beq 1b\n"
- ! " movel a1@+,a0@\n"
- ! " movel a1@+,a0@\n"
- !
- ! " movel a1@,a1 | get buf\n"
- ! " movew #0x6c11,a0@(comm) | fmovep fp0,a1@{#17}\n"
- ! "1: cmpw #0x8900,a0@(resp)\n"
- ! " beq 1b\n"
- ! " movel a0@,a1@+\n"
- ! " movel a0@,a1@+\n"
- ! " movel a0@,a1@+\n"
- ! " rts\n"
- ! );
- #endif /* sfp004 */
-
- static int
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/eprintf.c,v
- retrieving revision 1.2
- diff -c -r1.2 eprintf.c
- *** 1.2 1992/06/03 14:48:43
- --- eprintf.c 1993/07/10 16:36:40
- ***************
- *** 1,6 ****
- - #include <stdio.h>
- #include <stdarg.h>
- #include <string.h>
- #include "lib.h"
-
- /* new file 4/15/92 sb
- --- 1,6 ----
- #include <stdarg.h>
- #include <string.h>
- + #include <assert.h>
- #include "lib.h"
-
- /* new file 4/15/92 sb
- ***************
- *** 12,24 ****
-
- 5/2/92 sb
- Modified to do its own work rather than call fprintf().
- - */
- -
-
- ! static char buf[20]; /* big enough for any value of a long */
-
- static void _say(s)
- ! char *s;
- {
- _write(2,s,(long)(strlen(s)));
- }
- --- 12,26 ----
-
- 5/2/92 sb
- Modified to do its own work rather than call fprintf().
-
- ! 5/4/93 uo
- ! Threw away a static buffer.
- ! */
- !
- ! static void _say __PROTO((const char *s));
-
- static void _say(s)
- ! const char *s;
- {
- _write(2,s,(long)(strlen(s)));
- }
- ***************
- *** 29,34 ****
- --- 31,38 ----
- const long line;
- const char *filename;
- {
- + char buf[20];
- +
- _ltoa(line, buf, 10);
- _say("assertion `");
- _say(expression);
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/findfile.c,v
- retrieving revision 1.11
- diff -c -r1.11 findfile.c
- *** 1.11 1992/09/14 14:56:40
- --- findfile.c 1993/07/13 17:03:43
- ***************
- *** 7,16 ****
- --- 7,19 ----
- Returns the name by which the file was found, or NULL.
-
- Written by Eric R. Smith and placed in the public domain.
- +
- + rehacked by Uwe Ohse, 28.4.93, to support reentrant spawn/popen.
- */
-
- #include <compiler.h>
- #include <limits.h> /* needed for PATH_MAX */
- + #include <support.h>
- #include <stddef.h>
- #include <types.h>
- #include <stat.h>
- ***************
- *** 27,33 ****
- static char *nullext[] = { NULL };
-
- static int EXISTS __PROTO((char *));
- - char *findfile __PROTO((char *fname, char *fpath, char **fext));
-
- static int
- EXISTS(name)
- --- 30,35 ----
- ***************
- *** 42,81 ****
- return 1;
- }
-
- char *
- findfile(fname, fpath, fext)
- char *fname, *fpath, **fext;
- {
- ! static char try[PATH_MAX];
- ! char *s, *t, *extplace, **nextext, c;
- ! int hasext = 0, haspath = 0;
-
- if (!fname || !*fname)
- return NULL;
-
- ! s = try; t = fname;
-
- /* copy the file in, checking to see if a path and/or extension are already
- given */
-
- ! while ( (c = *t++) != 0 ) {
- ! if (c == DIRSEP1 || c == DIRSEP2) {
- ! haspath = 1; hasext = 0;
- ! }
- ! else if (c == '.')
- ! hasext = 1;
- ! *s++ = c;
- ! }
- ! extplace = s;
- ! *s++ = 0;
- !
- ! if (haspath || !fpath)
- ! fpath = "";
- ! if (hasext || !fext)
- ! fext = nullext;
-
- ! for(;;) { /* loop on path elements */
- ! nextext = fext;
- if (!hasext) {
- extplace[0] = 0;
- extplace[1] = 0;
- --- 44,96 ----
- return 1;
- }
-
- +
- char *
- findfile(fname, fpath, fext)
- char *fname, *fpath, **fext;
- {
- ! /* simply calls buffindfile */
- ! static char try[PATH_MAX];
- ! return buffindfile(fname,fpath,fext,try);
- ! }
- !
- !
- ! char *
- ! buffindfile(fname, fpath, fext, try)
- ! char *fname, *fpath, **fext, *try;
- ! {
- ! char *s, *t, *extplace, **nextext, c;
- ! int hasext = 0, haspath = 0;
-
- if (!fname || !*fname)
- return NULL;
-
- ! s = try; t = fname;
-
- /* copy the file in, checking to see if a path and/or extension are already
- given */
-
- ! while ( (c = *t++) != 0 )
- ! {
- ! if (c == DIRSEP1 || c == DIRSEP2)
- ! {
- ! haspath = 1;
- ! hasext = 0;
- ! }
- ! else if (c == '.')
- ! hasext = 1;
- ! *s++ = c;
- ! }
- ! extplace = s;
- ! *s++ = 0;
- !
- ! if (haspath || !fpath)
- ! fpath = "";
- ! if (hasext || !fext)
- ! fext = nullext;
-
- ! for(;;) { /* loop on path elements */
- ! nextext = fext;
- if (!hasext) {
- extplace[0] = 0;
- extplace[1] = 0;
- ***************
- *** 84,107 ****
- if (EXISTS(try))
- return try;
- extplace[0] = '.';
- ! while(*nextext) { /* loop on extensions */
- ! (void)strcpy(&extplace[1], *nextext++);
- ! if (EXISTS(try))
- ! return try;
- ! }
- ! if (!*fpath) break; /* no more places to look */
-
- /* copy in next element of path list */
- ! s = try;
- ! while ((c = *fpath) != 0 && c != PATHSEP1 && c != PATHSEP2) {
- ! *s++ = c;
- ! fpath++;
- ! }
- ! if (c) fpath++;
- ! *s++ = DIRSEP1;
- ! t = fname;
- ! while ((*s++ = *t++) != 0) ;
- ! extplace = --s ; /* where the extension gets written */
- ! }
- ! return NULL;
- }
- --- 99,134 ----
- if (EXISTS(try))
- return try;
- extplace[0] = '.';
- ! while(*nextext) { /* loop on extensions */
- ! (void)strcpy(&extplace[1], *nextext++);
- ! if (EXISTS(try))
- ! return try;
- ! }
- ! if (!*fpath) break; /* no more places to look */
-
- /* copy in next element of path list */
- ! s = try;
- ! /* an attempt to accomodate within reason TOS specs -- mj */
- ! if (*(fpath + 1) == ':') {
- ! if ((*(fpath + 2) == DIRSEP1 ||
- ! *(fpath + 2) == DIRSEP2) &&
- ! (*fpath != '.' && *fpath != ':')) {
- ! *s++ = *fpath++;
- ! *s++ = *fpath++;
- ! *s++ = *fpath++;
- ! }
- ! }
- ! while ((c = *fpath) != 0 && c != PATHSEP1 && c != PATHSEP2) {
- ! *s++ = c;
- ! fpath++;
- ! }
- ! if (c)
- ! fpath++;
- ! *s++ = DIRSEP1;
- ! t = fname;
- ! while ((*s++ = *t++) != 0)
- ! ;
- ! extplace = --s ; /* where the extension gets written */
- ! }
- ! return NULL;
- }
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/fopen.c,v
- retrieving revision 1.19
- diff -c -r1.19 fopen.c
- *** 1.19 1993/03/01 17:34:29
- --- fopen.c 1993/07/10 16:36:41
- ***************
- *** 64,69 ****
- --- 64,70 ----
- iomode |= O_WRONLY;
- else
- iomode |= O_RDWR;
- + iomode |= O_NOCTTY;
- h = open(filename, iomode, 0644);
- if(h < __SMALLEST_VALID_HANDLE)
- {
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/fread.c,v
- retrieving revision 1.16
- diff -c -r1.16 fread.c
- *** 1.16 1993/02/18 00:00:23
- --- fread.c 1993/07/10 16:36:42
- ***************
- *** 2,7 ****
- --- 2,11 ----
- * from Dale Schumacher's dLibs
- */
-
- + /* 5/26/93 sb -- Modified for HSC to account for the possibility that
- + * size * count >= 64K.
- + */
- +
- #include <stddef.h>
- #include <stdio.h>
- #include <unistd.h>
- ***************
- *** 18,24 ****
- --- 22,32 ----
- size_t count;
- register FILE *fp;
- {
- + #ifdef __SOZOBON__
- + register unsigned long n;
- + #else
- register size_t n;
- + #endif
- register long l, cnt;
- register unsigned int f;
- char *data=_data;
- ***************
- *** 33,39 ****
- --- 41,51 ----
- return(0);
-
- l = 0;
- + #ifdef __SOZOBON__
- + n = (unsigned long)count * size;
- + #else
- n = count * size;
- + #endif
- #if 0
- if(fflush(fp)) /* re-sync file pointers */
- return 0;
- ***************
- *** 44,50 ****
- --- 56,66 ----
- if((cnt = fp->_cnt) > 0)
- {
- cnt = (cnt < n) ? cnt : n;
- + #ifdef __SOZOBON__
- + _bcopy(fp->_ptr, data, cnt);
- + #else
- bcopy(fp->_ptr, data, cnt);
- + #endif
- fp->_cnt -= cnt;
- fp->_ptr += cnt;
- l += cnt;
- ***************
- *** 138,142 ****
- --- 154,162 ----
- }
-
- ret:
- + #ifdef __SOZOBON__
- + return((l > 0) ? ((size_t)((unsigned long)l / size)) : 0);
- + #else
- return((l > 0) ? ((size_t)l / size) : 0);
- + #endif
- }
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/frexp.cpp,v
- retrieving revision 1.7
- diff -c -r1.7 frexp.cpp
- *** 1.7 1993/05/29 20:28:43
- --- frexp.cpp 1993/07/13 17:03:44
- ***************
- *** 174,179 ****
- --- 174,180 ----
-
- .globl _frexp
-
- + _frexp:
- tstl sp@(4) | 1st arg == 0 ?
- bne nonzero
- tstl sp@(8)
- ***************
- *** 210,216 ****
- .long 0x0c688900, 0xfff067f8
- movew a0@,a1@ | return exp
- #else
- ! movew #0x7880,a0@(comm) | fetch exp (fmovel from fp1)
- .long 0x0c688900, 0xfff067f8
- movel a0@,a1@ | return exp
- #endif
- --- 211,217 ----
- .long 0x0c688900, 0xfff067f8
- movew a0@,a1@ | return exp
- #else
- ! movew #0x6080,a0@(comm) | fetch exp (fmovel from fp1)
- .long 0x0c688900, 0xfff067f8
- movel a0@,a1@ | return exp
- #endif
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/fwrite.c,v
- retrieving revision 1.13
- diff -c -r1.13 fwrite.c
- *** 1.13 1992/09/14 14:56:40
- --- fwrite.c 1993/07/10 16:36:44
- ***************
- *** 1,5 ****
- --- 1,9 ----
- /* from Dale Schumacher's dLibs */
-
- + /* 5/26/93 sb -- Modified for HSC to account for the possibility that
- + * size * count >= 64K.
- + */
- +
- #include <stddef.h>
- #include <stdio.h>
- #include <unistd.h>
- ***************
- *** 17,23 ****
- --- 21,31 ----
- register FILE *fp;
- {
- const char *data=_data;
- + #ifdef __SOZOBON__
- + register unsigned long n, m;
- + #else
- register size_t n, m;
- + #endif
- register long l = 0;
- long space;
- unsigned int f = fp->_flag;
- ***************
- *** 38,52 ****
- --- 46,69 ----
-
- assert ((data != NULL));
- assert ((size != 0));
- + #ifdef __SOZOBON__
- + n = (unsigned long)count * size;
- + assert ( n <= (unsigned_long)LONG_MAX); /* otherwise impl will not work */
- + #else
- n = count * size;
- assert ( n <= (size_t)LONG_MAX); /* otherwise impl will not work */
- + #endif
-
- if( (f&_IOBIN) || __FRW_BIN__ ) {
- space = fp->_bsiz - fp->_cnt;
- while(n > 0)
- {
- m = (n > space)? space: n;
- + #ifdef __SOZOBON__
- + _bcopy(data, fp->_ptr, m);
- + #else
- bcopy(data, fp->_ptr, m);
- + #endif
- fp->_ptr += m;
- fp->_cnt += m;
- space -= m;
- ***************
- *** 77,84 ****
- line_flush=0;
- /* this relies on having at least one byte buffer,
- otherwise we'll hang up when trying to write CRLF */
- ! while(n > 0)
- ! {
- space = fp->_bsiz - fp->_cnt;
- restart_buf=data;
- while( space>0 && n>0 ) {
- --- 94,100 ----
- line_flush=0;
- /* this relies on having at least one byte buffer,
- otherwise we'll hang up when trying to write CRLF */
- ! while(n > 0) {
- space = fp->_bsiz - fp->_cnt;
- restart_buf=data;
- while( space>0 && n>0 ) {
- ***************
- *** 120,134 ****
- n--;
- data++;
- }
- ! if( (m=_write(fp->_file, restart_buf, data-restart_buf ))
- ! != data-restart_buf ) {
- fp->_flag |= _IOERR;
- return 0;
- }
- ! l+=m;
- }
- }
- ! }
- if( line_flush ) {
- if(fflush(fp))
- return 0;
- --- 136,151 ----
- n--;
- data++;
- }
- ! if( (m = _write(fp->_file, restart_buf, data - restart_buf))
- ! != data - restart_buf) {
- fp->_flag |= _IOERR;
- return 0;
- }
- ! l += (m - 1); /* we already counted one character, before
- ! * decrementing 'space' to zero */
- }
- }
- ! } /* while */
- if( line_flush ) {
- if(fflush(fp))
- return 0;
- ***************
- *** 137,141 ****
- --- 154,162 ----
- }
- }
-
- + #ifdef __SOZOBON
- + return((l > 0) ? ((size_t)((unsigned long)l / size)) : 0);
- + #else
- return((l > 0) ? ((size_t)l / size) : 0);
- + #endif
- }
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/getpw.c,v
- retrieving revision 1.11
- diff -c -r1.11 getpw.c
- *** 1.11 1992/09/14 14:56:40
- --- getpw.c 1993/07/10 16:36:45
- ***************
- *** 31,212 ****
-
- /* minorly customized by ERS for the MiNT library */
-
- #include <stdio.h>
- #include <pwd.h>
- #include <unistd.h>
- #include <string.h>
- #include <stdlib.h>
-
- ! static char *pwdfile = "/etc/passwd"; /* default passwd file */
-
- static FILE *fp = NULL;
- ! static struct passwd curentry; /* static data to return */
-
- ! static int nextent __PROTO((void));
-
- ! void setpwfile (cp)
- char *cp;
- {
- ! endpwent();
- ! if(cp) pwdfile = cp;
- ! }
- !
- ! void setpwent ()
- ! {
- ! if (fp)
- ! rewind (fp);
- ! #ifdef atarist
- ! else if ((fp = fopen (pwdfile, "rt")) == NULL)
- ! #else
- ! else if ((fp = fopen (pwdfile, "r")) == NULL)
- ! #endif
- ! {
- #ifdef VERBOSE
- ! fprintf (stderr,
- ! "setpwent: %s non-existant or unreadable.\n", pwdfile);
- #endif
- ! }
- ! }
-
- ! void endpwent ()
- {
- ! if (fp)
- ! {
- ! fclose (fp);
- ! fp = NULL;
- ! }
- ! }
-
- ! struct passwd *getpwent ()
- {
- ! if (! fp ) {
- ! setpwent();
- ! if (! fp )
- ! return (NULL);
- ! }
- !
- ! if (! nextent ())
- ! return (NULL);
- ! else
- ! return (& curentry);
- ! }
- !
- ! struct passwd *getpwuid (uid)
- ! register int uid;
- {
- ! setpwent ();
- ! while (nextent ())
- ! if (curentry.pw_uid == uid)
- ! return (& curentry);
- !
- ! return (NULL);
- ! }
-
- ! struct passwd *getpwnam (name)
- ! register const char *name;
- {
- ! setpwent ();
-
- ! while (nextent ())
- ! if (strcmp (curentry.pw_name, name) == 0)
- ! return (& curentry);
-
- ! return (NULL);
- ! }
-
- ! #ifdef atarist
- ! static char savbuf[256]; /* BUFSIZ seems bigger than necessary! */
- #else
- static char savbuf[BUFSIZ];
- #endif
- !
- ! static int nextent ()
- {
- ! register char *cp;
-
- ! if (! fp ) {
- ! setpwent ();
- ! if (! fp )
- ! return (0);
- ! }
- !
- ! while (fgets (savbuf, (int)sizeof(savbuf), fp) != NULL)
- ! {
- ! for (cp = savbuf; *cp && *cp != ':'; cp++)
- ! ;
- ! curentry.pw_name = savbuf;
- ! *cp++ = '\0';
- ! curentry.pw_passwd = cp;
- ! for (; *cp && *cp != ':'; cp++)
- ! ;
- ! *cp++ = '\0';
- ! curentry.pw_uid = atoi (cp);
- ! for (; *cp && *cp != ':'; cp++)
- ! ;
- ! *cp++ = '\0';
- ! curentry.pw_gid = atoi (cp);
- ! for (; *cp && *cp != ':'; cp++)
- ! ;
- ! *cp++ = '\0';
- ! curentry.pw_gecos = cp;
- ! for (; *cp && *cp != ':'; cp++)
- ! ;
- ! *cp++ = '\0';
- ! curentry.pw_dir = cp;
- ! for (; *cp && *cp != ':'; cp++)
- ! ;
- ! *cp++ = '\0';
- ! curentry.pw_shell = cp;
- ! for (; *cp && *cp != ':' && *cp != '\n'; cp++)
- ! ;
- ! *cp++ = '\0';
- ! return (1);
- ! }
- ! return (0);
- ! }
- !
- ! #ifdef TEST
- ! main (argc, argv)
- ! int argc;
- ! char **argv;
- ! {
- ! struct passwd *pwd;
- !
- ! if (argc > 1)
- ! setpwfile (argv[1]);
- !
- ! setpwent ();
- ! while ((pwd = getpwent ()) != NULL)
- ! {
- ! printf ("%s:\n\t%s\n\t%d\n\t%d\n\t%s\n\t%s\n\t%s\n",
- ! pwd->pw_name,
- ! pwd->pw_passwd,
- ! pwd->pw_uid,
- ! pwd->pw_gid,
- ! pwd->pw_gecos,
- ! pwd->pw_dir,
- ! pwd->pw_shell);
- ! }
- ! endpwent ();
- !
- ! if (pwd = getpwnam ("operator"))
- ! printf ("%s:\n\t%s\n\t%d\n\t%d\n\t%s\n\t%s\n\t%s\n",
- ! pwd->pw_name,
- ! pwd->pw_passwd,
- ! pwd->pw_uid,
- ! pwd->pw_gid,
- ! pwd->pw_gecos,
- ! pwd->pw_dir,
- ! pwd->pw_shell);
- !
- ! if (pwd = getpwuid (1))
- ! printf ("%s:\n\t%s\n\t%d\n\t%d\n\t%s\n\t%s\n\t%s\n",
- ! pwd->pw_name,
- ! pwd->pw_passwd,
- ! pwd->pw_uid,
- ! pwd->pw_gid,
- ! pwd->pw_gecos,
- ! pwd->pw_dir,
- ! pwd->pw_shell);
- ! }
- ! #endif
- --- 31,458 ----
-
- /* minorly customized by ERS for the MiNT library */
-
- + /****************************************************************/
- + /* Module name: getpw.c */
- + /* Library name: mintlibs for Atari ST */
- + /* Author: Hildo Biersma (boender@dutiws.twi.tudelft.nl) */
- + /* Date: January 29, 1993 */
- + /* Revision: 1 (add password aging, add System V routines, */
- + /* include three man pages, add example code) */
- + /****************************************************************/
- +
- + /*
- + NAME
- + getpw - get name from UID
- +
- + SYNOPSIS
- + #include <pwd.h>
- +
- + int getpw(int uid, char *buf);
- +
- + DESCRIPTION
- + getpw searches the password file for a user id number that
- + equals uid, copies the line of the password file in which uid
- + was found into the array pointed to by buf, and returns 0.
- + getpw returns non-zero if uid cannot be found.
- +
- + This routine is included only for compatibility with old UN*X
- + systems and should not be used in any new programs; see
- + getpwent for routines to use instead.
- +
- + FILES
- + /etc/passwd
- +
- + SEE ALSO
- + getpwent
- +
- + AUTHOR
- + Hildo Biersma, with the help of a UN*X System V man page.
- + */
- +
- + /*
- + NAME
- + getpwent, getpwuid, getpwnam, setpwent, endpwent,
- + fgetpwent, setpwfile - get password file entry
- +
- + SYNOPSIS
- + #include <stdio.h> // Only needed for fgetpwent
- + #include <pwd.h>
- +
- + struct passwd *getpwent(void);
- +
- + struct passwd *getpwuid(int uid);
- +
- + struct passwd *getpwnam(const char *name);
- +
- + void setpwent(void);
- +
- + void endpwent(void);
- +
- + struct passwd *fgetpwent(FILE *f);
- +
- + void setpwfile(const char *name);
- +
- + DESCRIPTION
- + getpwent, getpwuid and getpwnam each returns a pointer to an
- + object containing the broken-out fields of a line in the
- + /etc/passwd file.
- + Each line in the file contains a "passwd" structure, declared
- + in the <pwd.h> header file. For the definition of this structure
- + and the meaning of the fields, see the <pwd.h> header file.
- +
- + getpwent when first called returns a pointer to the first
- + passwd structure in the file; thereafter, it returns a pointer
- + to the next passwd structure in the file; so successive calls
- + can be used to search the entire file.
- +
- + getpwuid searches from the beginning of the file until a
- + numerical user ID is found matching uid is found and returns
- + a pointer to the particular structure in which it was found.
- + Thus, it cannot be found to search for several users having
- + duplicate numerical user IDs.
- +
- + getpwnam searches from the beginning of the file until a
- + login name matching name is found and returns a pointer to
- + the particular structure in which it was found.
- +
- + If an EOF or an error is encountered on reading, getpwent,
- + getpwuid and getpwnam return a NULL pointer.
- +
- + A call to setpwent has the effect of rewinding the password
- + file to allow repeated searches.
- +
- + endpwent may be called to close the password file when
- + processing is complete.
- +
- + fgetpwent returns a pointer to the next passwd structure in
- + the stream f, which matches the format of /etc/passwd.
- +
- + setpwfile will set the password file to be read from by all
- + the above routines except fgetpwent.
- +
- + FILES
- + /etc/passwd
- +
- + SEE ALSO
- + getlogin, getgrent, putpwent
- +
- + NOTES
- + All information is contained in a static area, so it must
- + be copied if it is to be saved.
- +
- + Password aging is supported.
- +
- + In order not to suffer from possible future changes in the
- + format of the passwd file or in the passwd structure,
- + these routines should always be used for reading from file,
- + while putpwent should always be used for writing to file.
- +
- + These routines expect the passwd file to be of type text,
- + and can therefore read both DOS and UN*X format files.
- +
- + AUTHORS
- + Arnold D. Robbins - original version
- + Eric Smith - adapted for the mintlibs
- + Hildo Biersma - included System V routines and password aging
- + */
- +
- + /*
- + PASSWORD AGING
- +
- + DESCRIPTION
- + Password aging is in effect for a particular user if his
- + encrypted password in the password file is followed by a
- + comma and a non-null string of characters from the
- + alphabet (., /, 0-9, A-Z, a-z) also used for the encrypted
- + password. (Such a string must be introduced in the first
- + place by the super-user.)
- +
- + The first character of the age, M say, denotes the maximum
- + number of weeks for which a password is valid. A user who
- + attempts to login after his password has expired should be
- + forced to supply a new one. The next character, N say,
- + denotes the minimum number of weeks which must expire
- + before the password may be changed. The remaining characters
- + define the week (counted from the beginning of 1970) when
- + the password was last changed. (A null string is equivalent
- + to zero.) M and N have numerical values in the range 0-63
- + that correspond to the 64-character alphabet mentioned
- + above (i.e., / = 1 week; z = 63 weeks). If M = N = 0
- + (derived from the string . or ..) the user should be forced
- + to change his password the next time he logs in (and the
- + "age" should disappear from his entry in the password file).
- + If N > M (signified, e.g., by the string /.) only the
- + super-user should be able to change the password.
- +
- + SEE ALSO
- + a64l, getpwent, putpwent
- +
- + NOTE
- + The compliance with password aging in MiNT is a joke, since
- + users are not forced to login. Also, the current login program
- + supplied in init(1) does not support password aging. This may
- + change in the future.
- + */
- +
- + /*
- + FIXME:
- + - test *thoroughly*
- + - write example code for modifying passwd files, include below
- + */
- +
- #include <stdio.h>
- #include <pwd.h>
- #include <unistd.h>
- #include <string.h>
- #include <stdlib.h>
-
- ! static char *pwdfile = "/etc/passwd"; /* default passwd file */
-
- static FILE *fp = NULL;
- ! static struct passwd curentry; /* static data to return */
-
- ! static int nextent __PROTO((FILE *fp));
-
- ! /* Get name from uid */
- ! int getpw(uid, buf)
- ! int uid;
- ! char *buf;
- ! {
- ! FILE *pw;
- ! char line[256]; /* Assume this will always be enough */
- ! char *ptr;
- !
- ! if ((pw = fopen("/etc/passwd", "rt")) == NULL)
- ! return(-1); /* Failure: file could not be opened */
- !
- ! line[255] = 0x00;
- ! while (!feof(pw))
- ! {
- ! fgets(line, 255, pw);
- ! if ((ptr = strchr(line, ':')) != NULL) /* Password field found */
- ! if ((ptr = strchr(ptr + 1, ':')) != NULL) /* UID field found */
- ! if (atoi(ptr + 1) == uid)
- ! {
- ! strcpy(buf, line);
- ! return(0); /* Success */
- ! }
- ! }
- ! return(-1); /* Failure */
- ! } /* End of getpw() */
- !
- ! /* Set the name of the passwd file */
- ! void setpwfile(cp)
- char *cp;
- {
- ! endpwent();
- ! if (cp != NULL)
- ! pwdfile = cp;
- ! } /* End of setpwfile() */
- !
- ! /* Rewind the passwd file */
- ! void setpwent()
- ! {
- ! if (fp != NULL)
- ! rewind(fp);
- ! else if ((fp = fopen (pwdfile, "rt")) == NULL)
- ! {
- #ifdef VERBOSE
- ! fprintf (stderr, "setpwent: %s non-existant or unreadable.\n", pwdfile);
- #endif
- ! }
- ! } /* End of setpwent() */
-
- ! /* End passwd file processing */
- ! void endpwent()
- {
- ! if (fp != NULL)
- ! {
- ! fclose (fp);
- ! fp = NULL;
- ! }
- ! } /* End of endpwent() */
-
- ! /* Get the next passwd entry from the passwd file */
- ! struct passwd *getpwent()
- {
- ! if (fp == NULL)
- ! {
- ! setpwent();
- ! if (fp == NULL)
- ! return(NULL);
- ! }
- !
- ! if (nextent(fp) == 0)
- ! return(NULL);
- ! else
- ! return(&curentry);
- ! } /* End of getpwent() */
- !
- ! /* Get first passwd entry from file with pw_uid matching uid */
- ! struct passwd *getpwuid(uid)
- ! int uid;
- {
- ! setpwent();
- ! while (nextent(fp) != 0)
- ! if (curentry.pw_uid == uid)
- ! return(&curentry);
- !
- ! return(NULL);
- ! } /* End of getpwuid() */
- !
- ! /* Get first passwd entry from file with pw_name matching name */
- ! struct passwd *getpwnam(name)
- ! const char *name;
- ! {
- ! setpwent();
-
- ! while (nextent(fp) != 0)
- ! if (strcmp(curentry.pw_name, name) == 0)
- ! return(&curentry);
- !
- ! return(NULL);
- ! } /* End of getpwnam() */
- !
- ! /* Read the next password structure from a given file */
- ! struct passwd *fgetpwent(f)
- ! FILE *f;
- {
- ! if (f == NULL)
- ! return(NULL); /* Failure */
-
- ! if (nextent(f) != 0)
- ! return(&curentry); /* Success */
-
- ! return(NULL); /* Failure */
- ! } /* End of fgetpwent() */
-
- ! #if defined(atarist) || defined(__SOZOBON__)
- ! static char savbuf[256]; /* BUFSIZ seems bigger than necessary! */
- #else
- static char savbuf[BUFSIZ];
- #endif
- !
- ! /* Static function getting next entry from passwd file */
- ! static int nextent(fp)
- ! FILE *fp;
- {
- ! char *cp;
-
- ! if (fp == NULL)
- ! {
- ! setpwent();
- ! if (fp == NULL)
- ! return(0);
- ! }
- !
- ! while (fgets(savbuf, (int)sizeof(savbuf), fp) != NULL)
- ! {
- ! curentry.pw_age = NULL;
- !
- ! for (cp = savbuf; ((*cp != 0x00) && (*cp != ':')); cp++)
- ! ;
- ! curentry.pw_name = savbuf;
- ! *cp++ = 0x00;
- ! curentry.pw_passwd = cp;
- ! for (; ((*cp != 0x00) && (*cp != ':')); cp++)
- ! if ((*cp == ',') && (curentry.pw_age == NULL))
- ! {
- ! /* Password age field found */
- ! *cp++ = 0x00;
- ! curentry.pw_age = cp;
- ! }
- ! *cp++ = 0x00;
- ! curentry.pw_uid = atoi(cp);
- ! for (; ((*cp != 0x00) && (*cp != ':')); cp++)
- ! ;
- ! *cp++ = 0x00;
- ! curentry.pw_gid = atoi(cp);
- ! for (; ((*cp != 0x00) && (*cp != ':')); cp++)
- ! ;
- ! *cp++ = 0x00;
- ! curentry.pw_gecos = cp;
- ! curentry.pw_comment = cp;
- ! for (; ((*cp != 0x00) && (*cp != ':')); cp++)
- ! ;
- ! *cp++ = 0x00;
- ! curentry.pw_dir = cp;
- ! for (; ((*cp != 0x00) && (*cp != ':')); cp++)
- ! ;
- ! *cp++ = 0x00;
- ! curentry.pw_shell = cp;
- ! for (; ((*cp != 0x00) && (*cp != ':') && (*cp != '\n')); cp++)
- ! ;
- ! *cp = 0x00;
- ! if (curentry.pw_age == NULL)
- ! curentry.pw_age = cp; /* Don't return NULL, return a null string */
- ! return(1);
- ! }
- ! return(0);
- ! } /* End of nextent() */
- !
- ! /* Old test program removed - Hildo Biersma */
- ! #ifdef EXAMPLE
- !
- ! /*
- ! EXAMPLE PROGRAM
- !
- ! DESCRIPTION
- ! Read all lines from the password file and print all users
- ! with password aging info. Also print a description of
- ! the meaning of the aging information of this user.
- !
- ! AUTHOR
- ! Hildo Biersma (boender@dutiws.twi.tudelft.nl)
- !
- ! STATUS
- ! Example code; in the public domain.
- ! */
- !
- ! #include <support.h>
- !
- ! void main()
- ! {
- ! struct passwd *this_entry;
- ! int max_age, min_age;
- ! char *ptr, min[2], max[2];
- ! time_t time;
- !
- ! min[1] = max[1] = 0x00;
- ! while ((this_entry = getpwent()) != NULL)
- ! if ((this_entry->pw_age[0]) != 0x00)
- ! {
- ! if ((max[0] = this_entry->pw_age[0]) != 0x00)
- ! {
- ! max_age = (int)a64l(max);
- ! if ((min[0] = this_entry->pw_age[1]) != 0x00)
- ! {
- ! min_age = (int)a64l(min);
- ! ptr = this_entry->pw_age + 2;
- ! time = a64l(ptr) * (3600L * 24 * 7); /* Seconds per week */
- ! }
- ! else
- ! time = 0L;
- ! }
- ! else
- ! {
- ! min_age = 0;
- ! time = 0L;
- ! }
- ! fprintf(stdout, "Name: %s, UID: %d.\n", this_entry->pw_name,
- ! this_entry->pw_uid);
- ! if ((max_age == 0) && (min_age == 0))
- ! fprintf(stdout, "User should change password on next login.\n\n");
- ! else if (min_age > max_age)
- ! fprintf(stdout, "Only super-user may change password.\n\n");
- ! else
- ! {
- ! fprintf(stdout, "Must change every %d weeks.\n", max_age);
- ! fprintf(stdout, "May change every %d weeks.\n", min_age);
- ! fprintf(stdout, "Last changed in week starting %s\n\n",
- ! ctime(&time));
- ! }
- ! }
- !
- ! endpwent();
- ! } /* End of main() */
- ! #endif /* EXAMPLE */
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/getuid.c,v
- retrieving revision 1.10
- diff -c -r1.10 getuid.c
- *** 1.10 1993/02/18 00:00:27
- --- getuid.c 1993/06/04 19:55:49
- ***************
- *** 67,80 ****
- return setgid(egid);
- }
-
- - /* note: BSD getpgrp takes an argument, but ours doesn't */
- - int getpgrp() { return __mint ? Pgetpgrp() : 0; }
- -
- - int setpgrp(pid, grp)
- - int pid, grp;
- - {
- - return __mint ? Psetpgrp(pid, grp) : 0;
- - }
- -
- int seteuid(x) int x; { return setuid(x); }
- int setegid(x) int x; { return setgid(x); }
- --- 67,71 ----
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/grp.c,v
- retrieving revision 1.6
- diff -c -r1.6 grp.c
- *** 1.6 1992/09/14 14:56:40
- --- grp.c 1993/07/10 16:36:46
- ***************
- *** 4,129 ****
- * getpwent routines (see getpw.c).
- */
-
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <grp.h>
-
- ! static char *grpfile = "/etc/group"; /* default group file */
- static FILE *fp;
-
- ! static struct group curentry; /* static data to return */
-
- ! static int nextent __PROTO((void));
-
- ! void setgrent ()
- {
- ! if (fp)
- ! rewind (fp);
- ! #ifdef atarist
- ! else if ((fp = fopen (grpfile, "rt")) == NULL)
- ! #else
- ! else if ((fp = fopen (grpfile, "r")) == NULL)
- ! #endif
- ! {
- #ifdef VERBOSE
- ! fprintf (stderr,
- ! "setgrent: %s non-existant or unreadable.\n", grpfile);
- #endif
- ! }
- ! }
-
- ! void endgrent ()
- {
- ! if (fp)
- ! {
- ! fclose (fp);
- ! fp = NULL;
- ! }
- ! }
-
- ! struct group *getgrent ()
- {
- ! if (!fp) setgrent();
- ! if (!fp) return NULL;
-
- ! if (! nextent ())
- ! return (NULL);
- ! else
- ! return (& curentry);
- ! }
-
- ! struct group *getgrgid (gid)
- ! int gid;
- {
- ! setgrent();
-
- ! while (nextent ())
- ! if (curentry.gr_gid == gid)
- ! return (& curentry);
-
- ! return (NULL);
- ! }
-
- ! struct group *getgrnam (name)
- ! register char *name;
- {
- ! setgrent();
-
- ! while (nextent ())
- ! if (strcmp (curentry.gr_name, name) == 0)
- ! return (& curentry);
-
- ! return (NULL);
- ! }
-
- ! #define MAX_MEMBERS 128 /* max. number of members in a group */
-
- static char savbuf[512];
- static char *memb[MAX_MEMBERS];
-
- ! static int nextent ()
- {
- ! register char *cp;
- ! register int i;
- !
- ! if (!fp) setgrent();
- ! if (!fp) return 0;
-
- ! if (fgets (savbuf, (int) sizeof(savbuf), fp) != NULL)
- ! {
- ! for (cp = savbuf; *cp && *cp != ':'; cp++)
- ! ;
- ! curentry.gr_name = savbuf;
- ! *cp++ = '\0';
- ! curentry.gr_passwd = cp;
- ! for (; *cp && *cp != ':'; cp++)
- ! ;
- ! *cp++ = '\0';
- ! curentry.gr_gid = atoi (cp);
- ! for (; *cp && *cp != ':'; cp++)
- ! ;
- !
- ! *cp++ = '\0';
- !
- ! i = 0;
- ! while( *cp ) {
- ! if (i >= MAX_MEMBERS-1) break;
- ! memb[i++] = cp;
- ! for(; *cp && *cp != ',' && *cp != '\n'; cp++)
- ! ;
- ! if (*cp == '\n')
- ! *cp = 0;
- ! else if (*cp)
- ! *cp++ = 0;
- ! }
- ! memb[i] = NULL;
- ! curentry.gr_mem = memb;
- ! return (1);
- ! }
- ! return (0);
- ! }
-
- #ifdef TEST
- int
- --- 4,157 ----
- * getpwent routines (see getpw.c).
- */
-
- + /*
- + Revised by Hildo Biersma (boender@dutiws.twi.tudelft.nl)
- + Revision 1 (January 31, 1993): include fgetgrent()
- + */
- +
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <grp.h>
-
- ! static char *grpfile = "/etc/group"; /* default group file */
- static FILE *fp;
-
- ! static struct group curentry; /* static data to return */
-
- ! static int nextent __PROTO((FILE *fp));
-
- ! /* Rewind the group file to allow repeated searches */
- ! void setgrent()
- {
- ! if (fp != NULL)
- ! rewind (fp);
- ! else if ((fp = fopen (grpfile, "rt")) == NULL)
- ! {
- #ifdef VERBOSE
- ! fprintf (stderr,
- ! "setgrent: %s non-existant or unreadable.\n", grpfile);
- #endif
- ! }
- ! } /* End of setgrent() */
-
- ! /* Close the group file when processing is complete */
- ! void endgrent()
- {
- ! if (fp != NULL)
- ! {
- ! fclose (fp);
- ! fp = NULL;
- ! }
- ! } /* End of endgrent() */
-
- ! /* Get the next group structure in the file */
- ! struct group *getgrent()
- {
- ! if (fp == NULL)
- ! setgrent();
- ! if (fp == NULL)
- ! return NULL;
-
- ! if (nextent(fp) == 0)
- ! return(NULL);
- ! else
- ! return(&curentry);
- ! } /* End of getgrent() */
-
- ! /* Get first group with matching numerical group ID from file */
- ! struct group *getgrgid(gid)
- ! int gid;
- {
- ! setgrent();
-
- ! while (nextent(fp) != 0)
- ! if (curentry.gr_gid == gid)
- ! return(&curentry);
-
- ! return(NULL);
- ! } /* End of getgrid() */
-
- ! /* Get first group with matching group name from file */
- ! struct group *getgrnam(name)
- ! const char *name;
- {
- ! setgrent();
-
- ! while (nextent(fp) != 0)
- ! if (strcmp (curentry.gr_name, name) == 0)
- ! return (&curentry);
-
- ! return(NULL);
- ! } /* End of getgrnam() */
- !
- ! /* Read the next group structure from a given file */
- ! struct group *fgetgrent(f)
- ! FILE *f;
- ! {
- ! if (f == NULL)
- ! return(NULL); /* Failure */
- !
- ! if (nextent(f) != 0)
- ! return(&curentry); /* Success */
-
- ! return(NULL); /* Failure */
- ! } /* End of fgetgrent() */
-
- + #define MAX_MEMBERS 128 /* max. number of members in a group */
- +
- static char savbuf[512];
- static char *memb[MAX_MEMBERS];
-
- ! static int nextent(fp)
- ! FILE *fp;
- {
- ! register char *cp;
- ! register int i;
-
- ! if (fp == NULL)
- ! setgrent();
- ! if (fp == NULL)
- ! return(0);
- !
- ! if (fgets(savbuf, (int)sizeof(savbuf), fp) != NULL)
- ! {
- ! for (cp = savbuf; *cp && *cp != ':'; cp++)
- ! ;
- ! curentry.gr_name = savbuf;
- ! *cp++ = 0x00;
- ! curentry.gr_passwd = cp;
- ! for (; *cp && *cp != ':'; cp++)
- ! ;
- ! *cp++ = 0x00;
- ! curentry.gr_gid = atoi (cp);
- ! for (; *cp && *cp != ':'; cp++)
- ! ;
- !
- ! *cp++ = 0x00;
- !
- ! i = 0;
- ! while( *cp )
- ! {
- ! if (i >= MAX_MEMBERS-1)
- ! break;
- ! for (; *cp == ' '; cp++)
- ! ;
- ! memb[i++] = cp;
- ! for(; *cp && *cp != ',' && *cp != '\n'; cp++)
- ! ;
- ! if (*cp == '\n')
- ! *cp = 0;
- ! else if (*cp)
- ! *cp++ = 0;
- ! }
- ! memb[i] = NULL;
- ! curentry.gr_mem = memb;
- ! return(1);
- ! }
- ! return(0);
- ! } /* End of nextent() */
-
- #ifdef TEST
- int
- ***************
- *** 131,174 ****
- int argc;
- char **argv;
- {
- ! struct group *gr;
- ! char **m;
-
- ! if (argc > 1) {
- ! grpfile = argv[1];
- ! }
- !
- ! setgrent ();
- ! while ((gr = getgrent ()) != NULL)
- ! {
- ! printf ("%s:[%s] %d\n",
- ! gr->gr_name,
- ! gr->gr_passwd,
- ! gr->gr_gid);
- ! for (m = gr->gr_mem; *m; m++) {
- ! printf("\t%s\n", *m);
- ! }
- ! }
- ! endgrent ();
- !
- ! if (gr = getgrnam ("mail")) {
- ! printf ("%s:[%s] %d\n",
- ! gr->gr_name,
- ! gr->gr_passwd,
- ! gr->gr_gid);
- ! for (m = gr->gr_mem; *m; m++) {
- ! printf("\t%s\n", *m);
- ! }
- ! }
- ! if (gr = getgrgid (1)) {
- ! printf ("%s:[%s] %d\n",
- ! gr->gr_name,
- ! gr->gr_passwd,
- ! gr->gr_gid);
- ! for (m = gr->gr_mem; *m; m++) {
- ! printf("\t%s\n", *m);
- ! }
- ! }
- ! return 0;
- }
- #endif
- --- 159,202 ----
- int argc;
- char **argv;
- {
- ! struct group *gr;
- ! char **m;
-
- ! if (argc > 1) {
- ! grpfile = argv[1];
- ! }
- !
- ! setgrent ();
- ! while ((gr = getgrent ()) != NULL)
- ! {
- ! printf ("%s:[%s] %d\n",
- ! gr->gr_name,
- ! gr->gr_passwd,
- ! gr->gr_gid);
- ! for (m = gr->gr_mem; *m; m++) {
- ! printf("\t%s\n", *m);
- ! }
- ! }
- ! endgrent ();
- !
- ! if (gr = getgrnam ("mail")) {
- ! printf ("%s:[%s] %d\n",
- ! gr->gr_name,
- ! gr->gr_passwd,
- ! gr->gr_gid);
- ! for (m = gr->gr_mem; *m; m++) {
- ! printf("\t%s\n", *m);
- ! }
- ! }
- ! if (gr = getgrgid (1)) {
- ! printf ("%s:[%s] %d\n",
- ! gr->gr_name,
- ! gr->gr_passwd,
- ! gr->gr_gid);
- ! for (m = gr->gr_mem; *m; m++) {
- ! printf("\t%s\n", *m);
- ! }
- ! }
- ! return 0;
- }
- #endif
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/lib.h,v
- retrieving revision 1.9
- diff -c -r1.9 lib.h
- *** 1.9 1993/03/01 17:34:34
- --- lib.h 1993/07/10 16:36:48
- ***************
- *** 39,46 ****
- __EXTERN time_t _dostime __PROTO((time_t));
- __EXTERN time_t _unixtime __PROTO((unsigned int, unsigned int));
-
- - __EXTERN char * findfile __PROTO((char *, char *, char **));
- -
- __EXTERN char * _itoa __PROTO((int, char *, int));
- __EXTERN char * _ltoa __PROTO((long, char *, int));
- __EXTERN char * _ultoa __PROTO((unsigned long, char *, int));
- --- 39,44 ----
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/linea.c,v
- retrieving revision 1.5
- diff -c -r1.5 linea.c
- *** 1.5 1992/10/09 20:35:29
- --- linea.c 1993/07/10 16:36:49
- ***************
- *** 35,47 ****
-
- int linea2()
- {
- __asm__ volatile
- ("
- .word 0xA002"
- ! : /* outputs */
- : /* inputs */
- : "d0", "d1", "d2", "a0", "a1", "a2" /* clobbered regs */
- );
- }
-
- void linea3()
- --- 35,50 ----
-
- int linea2()
- {
- + register long retvalue __asm__("d0");
- +
- __asm__ volatile
- ("
- .word 0xA002"
- ! : "=r"(retvalue) /* outputs */
- : /* inputs */
- : "d0", "d1", "d2", "a0", "a1", "a2" /* clobbered regs */
- );
- + return (int) retvalue;
- }
-
- void linea3()
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/modf.cpp,v
- retrieving revision 1.3
- diff -c -r1.3 modf.cpp
- *** 1.3 1993/05/29 20:28:48
- --- modf.cpp 1993/07/13 17:03:45
- ***************
- *** 124,147 ****
- .globl _modf
- .even
- _modf:
- - movel a1,a7@- | save a1 (necessary?)
- lea 0xfffffa50:w,a0
- movew #0x5403,a0@(comm) | fintrz X -> fp0
- cmpiw #0x8900,a0@(resp) | check
- ! movel a7@(8),a0@ | load X_hi
- ! movel a7@(12),a0@ | load X_low
-
- movew #0x5480,a0@(comm) | X -> fp1
- .long 0x0c688900, 0xfff067f8
- ! movel a7@(8),a0@ | load X_hi
- ! movel a7@(12),a0@ | load X_low
-
- | 000 000 001 0101000 | sub fp0 -> fp1
- movew #0x00a8,a0@(comm) | sub fp0 -> fp1
- .word 0x4a68,0xfff0,0x6bfa | test
-
- movew #0x7400,a0@(comm) | fp0 to IntPart
- ! moveal a7@(16),a1 | address of IntPart while the fpu is active
- | wait
- .long 0x0c688900, 0xfff067f8
- movel a0@,a1@+
- --- 124,146 ----
- .globl _modf
- .even
- _modf:
- lea 0xfffffa50:w,a0
- movew #0x5403,a0@(comm) | fintrz X -> fp0
- cmpiw #0x8900,a0@(resp) | check
- ! movel a7@(4),a0@ | load X_hi
- ! movel a7@(8),a0@ | load X_low
-
- movew #0x5480,a0@(comm) | X -> fp1
- .long 0x0c688900, 0xfff067f8
- ! movel a7@(4),a0@ | load X_hi
- ! movel a7@(8),a0@ | load X_low
-
- | 000 000 001 0101000 | sub fp0 -> fp1
- movew #0x00a8,a0@(comm) | sub fp0 -> fp1
- .word 0x4a68,0xfff0,0x6bfa | test
-
- movew #0x7400,a0@(comm) | fp0 to IntPart
- ! moveal a7@(12),a1 | address of IntPart while the fpu is active
- | wait
- .long 0x0c688900, 0xfff067f8
- movel a0@,a1@+
- ***************
- *** 151,157 ****
- .long 0x0c688900, 0xfff067f8
- movel a0@,d0
- movel a0@,d1
- - movel a7@+,a1 | restore a1
- rts
-
- #endif sfp004
- --- 150,155 ----
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/psignal.c,v
- retrieving revision 1.5
- diff -c -r1.5 psignal.c
- *** 1.5 1992/06/01 01:54:10
- --- psignal.c 1993/07/10 16:36:51
- ***************
- *** 6,11 ****
- --- 6,12 ----
- #include <signal.h>
- #include <siglist.h>
- #include <string.h>
- + #include <unistd.h>
- #include "lib.h"
-
- void
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/putenv.c,v
- retrieving revision 1.2
- diff -c -r1.2 putenv.c
- *** 1.2 1992/09/14 14:56:40
- --- putenv.c 1993/07/10 16:36:53
- ***************
- *** 45,51 ****
-
- int
- putenv(strng)
- ! char *strng;
- {
- int i = 0;
- char **e;
- --- 45,51 ----
-
- int
- putenv(strng)
- ! const char *strng;
- {
- int i = 0;
- char **e;
- ***************
- *** 68,74 ****
- return -1;
-
- environ = e;
- ! environ[i] = strng;
- environ[i+1] = 0;
- return 0;
- }
- --- 68,74 ----
- return -1;
-
- environ = e;
- ! environ[i] = (char *)strng;
- environ[i+1] = 0;
- return 0;
- }
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/raise.c,v
- retrieving revision 1.2
- diff -c -r1.2 raise.c
- *** 1.2 1991/04/26 03:42:08
- --- raise.c 1993/07/10 16:36:54
- ***************
- *** 3,8 ****
- --- 3,9 ----
- */
-
- #include <unistd.h>
- + #include <signal.h>
-
- int
- raise(sig)
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/random.c,v
- retrieving revision 1.8
- diff -c -r1.8 random.c
- *** 1.8 1992/09/14 14:56:40
- --- random.c 1993/07/10 16:36:56
- ***************
- *** 189,195 ****
- unsigned x;
- {
- register int i /* , j */ ;
- - long random();
-
- if( rand_type == TYPE_0 ) {
- state[ 0 ] = x;
- --- 189,194 ----
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/regexp.c,v
- retrieving revision 1.7
- diff -c -r1.7 regexp.c
- *** 1.7 1993/02/18 00:00:30
- --- regexp.c 1993/07/10 16:36:59
- ***************
- *** 591,598 ****
-
- place = opnd; /* Op node, where operand used to be. */
- *place++ = op;
- ! *place++ = '\0';
- ! *place++ = '\0';
- }
-
- /*
- --- 591,597 ----
-
- place = opnd; /* Op node, where operand used to be. */
- *place++ = op;
- ! *place = '\0';
- }
-
- /*
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/regsup.c,v
- retrieving revision 1.1
- diff -c -r1.1 regsup.c
- *** 1.1 1991/04/12 18:19:53
- --- regsup.c 1993/07/10 16:37:01
- ***************
- *** 86,90 ****
- }
- }
- }
- ! *dst++ = '\0';
- }
- --- 86,90 ----
- }
- }
- }
- ! *dst = '\0';
- }
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/setjmp.cpp,v
- retrieving revision 1.5
- diff -c -r1.5 setjmp.cpp
- *** 1.5 1992/10/09 20:35:29
- --- setjmp.cpp 1993/07/10 16:37:02
- ***************
- *** 1,25 ****
- |
- | setjmp.cpp
- |
- .text
- .even
- .globl _setjmp
- _setjmp:
- movel sp@(4),a0 | address of jmp_buf[]
- movel sp@,a0@ | save return address
- moveml d2-d7/a2-a7,a0@(4) | save registers d2-d7/a2-a7
- clrl d0 | return value is 0
- rts
-
- .globl _longjmp
- - .globl ___mint
- -
- - #ifdef __MBASE__
- - #define Mint __MBASE__@(___mint)
- - #else
- - #define Mint ___mint
- - #endif
- -
- _longjmp:
- #ifdef __MSHORT__
- tstw Mint | see if MiNT is active
- --- 1,57 ----
- |
- | setjmp.cpp
- |
- +
- + .globl ___mint
- +
- + #ifdef __MBASE__
- + #define Mint __MBASE__@(___mint)
- + #define Sigmask __MBASE__@(__sigmask)
- + #else
- + #define Mint ___mint
- + #define Sigmask __sigmask
- + #endif
- +
- .text
- .even
- + .globl _sigsetjmp
- + _sigsetjmp:
- + movel sp@(4), a0 | address of sigjmp_buf[]
- + #ifdef __MSHORT__
- + movew sp@(8), d0
- + extl d0
- + #else
- + movel sp@(8), d0
- + #endif
- + movel d0, a0@(56) | save sigmask for siglongjmp?
- + beq SETJMP | no -- call common code
- + movel Sigmask, a0@(52) | save tos emulation signal mask
- + #ifdef __MSHORT__
- + tstw Mint | see if MiNT is active
- + #else
- + tstl Mint
- + #endif
- + beq SETJMP | no -- call common code
- + movel #0, sp@- | add no signals to sigmask
- + movew #0x116, sp@- | Psigblock() system call
- + trap #1 |
- + addqw #6, sp
- + movel d0, a0@(52) | save MiNT signal mask
- + jmp SETJMP | call common code
- +
- .globl _setjmp
- _setjmp:
- movel sp@(4),a0 | address of jmp_buf[]
- + movel #0, a0@(56) | do not restore sigmask on longjmp
- + SETJMP:
- movel sp@,a0@ | save return address
- moveml d2-d7/a2-a7,a0@(4) | save registers d2-d7/a2-a7
- clrl d0 | return value is 0
- rts
-
- + .globl _siglongjmp
- + _siglongjmp:
- .globl _longjmp
- _longjmp:
- #ifdef __MSHORT__
- tstw Mint | see if MiNT is active
- ***************
- *** 32,37 ****
- --- 64,83 ----
- addqw #2, sp
- NOMINT:
- movel sp@(4),a0 | address of jmp_buf[]
- + tstl a0@(56) | want to restore sigmask?
- + beq NORESTORE | no -- skip restore code
- + movel a0@(52), Sigmask | restore tos emulation signal mask
- + #ifdef __MSHORT__
- + tstw Mint | see if MiNT is active
- + #else
- + tstl Mint
- + #endif
- + beq NORESTORE | no -- do not call sigsetmask
- + movel a0@(52), sp@- | restore signal mask
- + movew #0x117, sp@- | Psigsetmask() system call
- + trap #1 |
- + addqw #6, sp
- + NORESTORE:
- #ifdef __MSHORT__
- movew sp@(8),d0 | value to return
- #else
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/strerror.c,v
- retrieving revision 1.6
- diff -c -r1.6 strerror.c
- *** 1.6 1993/03/01 17:34:39
- --- strerror.c 1993/07/10 16:37:03
- ***************
- *** 94,100 ****
- "name too long", /* 86 */
- "not a tty", /* 87 */
- "range error", /* 88 */
- ! "domain error" /* 89 */
- };
-
- int sys_nerr = (int)(sizeof(sys_errlist)/sizeof(sys_errlist[0]));
- --- 94,102 ----
- "name too long", /* 86 */
- "not a tty", /* 87 */
- "range error", /* 88 */
- ! "domain error", /* 89 */
- ! "I/O error", /* 90 */
- ! "disk full" /* 91 */
- };
-
- int sys_nerr = (int)(sizeof(sys_errlist)/sizeof(sys_errlist[0]));
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/strlwr.c,v
- retrieving revision 1.3
- diff -c -r1.3 strlwr.c
- *** 1.3 1993/03/01 17:34:43
- --- strlwr.c 1993/07/10 16:37:05
- ***************
- *** 1,4 ****
- --- 1,5 ----
- #include <ctype.h>
- + #include <string.h>
-
- char *strlwr(string)
- register char *string;
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/strrev.c,v
- retrieving revision 1.2
- diff -c -r1.2 strrev.c
- *** 1.2 1989/03/25 02:43:09
- --- strrev.c 1993/07/10 16:37:06
- ***************
- *** 4,9 ****
- --- 4,11 ----
- * please change mktemp.c too (it assumes rev is in-place)
- */
-
- + #include <string.h>
- +
- char *strrev(string)
- char *string;
- {
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/strupr.c,v
- retrieving revision 1.2
- diff -c -r1.2 strupr.c
- *** 1.2 1993/03/01 17:34:47
- --- strupr.c 1993/07/10 16:37:07
- ***************
- *** 1,5 ****
- --- 1,6 ----
- /* hohmuth 1-Nov-92, derived from strlwr.c */
- #include <ctype.h>
- + #include <string.h>
-
- char *strupr(string)
- register char *string;
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/sysvar.c,v
- retrieving revision 1.3
- diff -c -r1.3 sysvar.c
- *** 1.3 1992/09/14 14:56:40
- --- sysvar.c 1993/07/10 16:37:08
- ***************
- *** 8,14 ****
- long ret;
- long save_ssp;
-
- ! save_ssp = Super(0L);
- /* note: dont remove volatile, otherwise gcc will reorder these
- statements and we get bombs
- */
- --- 8,14 ----
- long ret;
- long save_ssp;
-
- ! save_ssp = (long) Super((void *) 0L);
- /* note: dont remove volatile, otherwise gcc will reorder these
- statements and we get bombs
- */
- ***************
- *** 24,30 ****
- {
- long save_ssp;
-
- ! save_ssp = Super(0L);
- *((volatile long *)var) = val;
- (void)Super((void *) save_ssp);
- }
- --- 24,30 ----
- {
- long save_ssp;
-
- ! save_ssp = (long) Super((void *) 0L);
- *((volatile long *)var) = val;
- (void)Super((void *) save_ssp);
- }
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/textio.c,v
- retrieving revision 1.5
- diff -c -r1.5 textio.c
- *** 1.5 1992/10/09 20:35:29
- --- textio.c 1993/07/10 16:37:10
- ***************
- *** 11,16 ****
- --- 11,17 ----
-
- #include <stdio.h>
- #include <unistd.h>
- + #include <support.h>
-
- int
- _text_read(fd, buf, nbytes)
- ***************
- *** 39,45 ****
- int
- _text_write(fd, from, nbytes)
- int fd;
- ! char *from;
- int nbytes;
- {
- #ifdef __SOZOBON__
- --- 40,46 ----
- int
- _text_write(fd, from, nbytes)
- int fd;
- ! const char *from;
- int nbytes;
- {
- #ifdef __SOZOBON__
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/timeoday.c,v
- retrieving revision 1.2
- diff -c -r1.2 timeoday.c
- *** 1.2 1992/09/14 14:56:40
- --- timeoday.c 1993/07/10 16:37:11
- ***************
- *** 51,57 ****
-
- tp->time = t;
- tp->millitm = 0;
- ! tp->timezone = _timezone / 60;
- tp->dstflag = (_dst) ? 1 : 0;
-
- return 0;
- --- 51,57 ----
-
- tp->time = t;
- tp->millitm = 0;
- ! tp->timezone = (int)(_timezone / 60);
- tp->dstflag = (_dst) ? 1 : 0;
-
- return 0;
- ===================================================================
- RCS file: /net/acae127/home/bammi/etc/src/master/atari/co/utime.c,v
- retrieving revision 1.11
- diff -c -r1.11 utime.c
- *** 1.11 1992/09/14 14:56:40
- --- utime.c 1993/06/04 19:55:54
- ***************
- *** 16,21 ****
- --- 16,29 ----
- #include <time.h>
- #include <errno.h>
- #include <osbind.h>
- + #include <mintbind.h>
- + #ifndef __MINT__
- + # define __MINT__
- + # include <ioctl.h>
- + # undef __MINT__
- + #else
- + # include <ioctl.h>
- + #endif
- #include <assert.h>
- #ifdef __TURBOC__
- #include <sys\types.h>
- ***************
- *** 24,35 ****
- #endif
- #include "lib.h"
-
- ! time_t dostime __PROTO((time_t t));
-
- /* convert a Unix time into a DOS time. The longword returned contains
- the time word first, then the date word */
-
- ! time_t dostime(t)
- time_t t;
- {
- time_t time, date;
- --- 32,46 ----
- #endif
- #include "lib.h"
-
- ! extern int __mint;
- !
- ! time_t _dostime __PROTO((time_t t));
-
- /* convert a Unix time into a DOS time. The longword returned contains
- the time word first, then the date word */
-
- ! time_t
- ! _dostime(t)
- time_t t;
- {
- time_t time, date;
- ***************
- *** 49,71 ****
- const struct utimbuf *tset;
- {
- int fh;
- ! time_t settime;
- unsigned long dtime; /* dos time equivalent */
- char filename[PATH_MAX];
-
- if (tset)
- ! settime = tset->modtime;
- else
- ! time(&settime);
-
- (void)_unx2dos(_filename, filename);
- ! dtime = dostime(settime); /* convert unix time to dos */
- fh = (int) Fopen(filename, 2);
- if (fh < 0) {
- errno = -fh;
- return -1;
- }
- ! (void)Fdatime((_DOSTIME *) &dtime, fh, 1);
- if ((fh = Fclose(fh)) != 0) {
- errno = -fh;
- return -1;
- --- 60,104 ----
- const struct utimbuf *tset;
- {
- int fh;
- ! time_t actime, modtime;
- unsigned long dtime; /* dos time equivalent */
- +
- char filename[PATH_MAX];
- + struct _mutimbuf settime;
- + long res;
-
- if (tset)
- ! {
- ! modtime = tset->modtime;
- ! actime = tset->actime;
- ! }
- else
- ! {
- ! time(&actime);
- ! modtime = actime;
- ! }
-
- (void)_unx2dos(_filename, filename);
- !
- ! dtime = _dostime(actime);
- ! settime.actime = (unsigned short) ((dtime >> 16) & 0xFFFF);
- ! settime.acdate = (unsigned short) (dtime & 0xFFFF);
- ! dtime = _dostime(modtime);
- ! settime.modtime = (unsigned short) ((dtime >> 16) & 0xFFFF);
- ! settime.moddate = (unsigned short) (dtime & 0xFFFF);
- fh = (int) Fopen(filename, 2);
- if (fh < 0) {
- errno = -fh;
- return -1;
- }
- !
- ! res = -EINVAL;
- ! if (__mint > 90)
- ! res = Fcntl(fh, (long)&settime, FUTIME);
- !
- ! if (res == -EINVAL)
- ! (void)Fdatime((_DOSTIME *) &dtime, fh, 1);
- !
- if ((fh = Fclose(fh)) != 0) {
- errno = -fh;
- return -1;
- ***************
- *** 80,86 ****
- unsigned date, time;
-
- assert(t != 0);
- ! dtime = dostime(*t);
- date = (int) (dtime & 0xffff);
- time = (int) (dtime >> 16) & 0xffff;
-
- --- 113,119 ----
- unsigned date, time;
-
- assert(t != 0);
- ! dtime = _dostime(*t);
- date = (int) (dtime & 0xffff);
- time = (int) (dtime >> 16) & 0xffff;
-
-